Class: Gjp::MavenRunner
- Includes:
- Logging
- Defined in:
- lib/gjp/maven_runner.rb
Overview
runs Maven with gjp-specific options
Instance Method Summary collapse
-
#get_effective_pom(pom_path) ⇒ Object
runs Maven to get the effective POM from an existing POM returns effective pom path or nil if not found.
-
#get_maven_commandline(prefix, options) ⇒ Object
returns a command line for running Maven from the specified prefix.
-
#get_source_jar(group_id, artifact_id, version) ⇒ Object
runs Maven to attempt getting a source jar returns true if successful.
-
#mvn(options) ⇒ Object
runs Maven in a subprocess.
Methods included from Logging
Methods inherited from KitRunner
#find_executable, #initialize, #run_executable
Constructor Details
This class inherits a constructor from Gjp::KitRunner
Instance Method Details
#get_effective_pom(pom_path) ⇒ Object
runs Maven to get the effective POM from an existing POM returns effective pom path or nil if not found
21 22 23 24 25 26 27 28 29 |
# File 'lib/gjp/maven_runner.rb', line 21 def get_effective_pom(pom_path) effective_pom_path = "#{pom_path}.effective" success = mvn(["help:effective-pom", "-f#{pom_path}", "-Doutput=#{File.split(effective_pom_path)[1]}"]) if success effective_pom_path else nil end end |
#get_maven_commandline(prefix, options) ⇒ Object
returns a command line for running Maven from the specified prefix
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gjp/maven_runner.rb', line 33 def get_maven_commandline(prefix, ) executable = find_executable("mvn") if !executable.nil? mvn_path = File.join(prefix, executable) repo_path = File.join(prefix, "kit", "m2") config_path = File.join(prefix, "kit", "m2", "settings.xml") "#{mvn_path} -Dmaven.repo.local=#{repo_path} -s#{config_path} #{.join(" ")}" else raise ExecutableNotFoundError.new("mvn") end end |
#get_source_jar(group_id, artifact_id, version) ⇒ Object
runs Maven to attempt getting a source jar returns true if successful
15 16 17 |
# File 'lib/gjp/maven_runner.rb', line 15 def get_source_jar(group_id, artifact_id, version) mvn(["dependency:get", "-Dartifact=#{group_id}:#{artifact_id}:#{version}:jar:sources", "-Dtransitive=false"]) end |
#mvn(options) ⇒ Object
runs Maven in a subprocess
9 10 11 |
# File 'lib/gjp/maven_runner.rb', line 9 def mvn() run_executable(get_maven_commandline(@project.full_path, )) end |