Module: Maven
- Defined in:
- lib/maven_irb_plugin/maven.rb
Constant Summary collapse
- BUILD_CLASSPATH_REGEX =
/classpath:\n(.*?)\n\[INFO\]/m
Class Method Summary collapse
Class Method Details
.load_dependencies(dir = FileUtils.pwd) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/maven_irb_plugin/maven.rb', line 10 def self.load_dependencies(dir = FileUtils.pwd) return unless maven_dir?(dir) $CLASSPATH << "#{dir}/target/classes" $CLASSPATH << "#{dir}/target/test-classes" FileUtils.cd(dir) do output = `mvn dependency:build-classpath` BUILD_CLASSPATH_REGEX.match(output)[1].split(':').each { |jar| require jar } end end |
.maven_dir?(dir = FileUtils.pwd) ⇒ Boolean
6 7 8 |
# File 'lib/maven_irb_plugin/maven.rb', line 6 def self.maven_dir?(dir = FileUtils.pwd) File.exist?(File.join(dir, 'pom.xml')) end |