Class: Naether::Maven
- Inherits:
-
Object
- Object
- Naether::Maven
- Defined in:
- lib/naether/maven.rb
Overview
Helper for interacting with a Maven POM
Class Method Summary (collapse)
-
+ (Naether::Maven) create_from_notation(notation)
Create an instance based on notation.
-
+ (Naether::Maven) create_from_pom(pom_path)
Create an instance from a POM.
Instance Method Summary (collapse)
-
- (Object) add_dependency(notation, scope = nil)
Add dependency by scope.
-
- (String) build_pom
Create the XML for a Maven Pom.
-
- (Object) dependencies(scopes = nil)
Get dependences for Project as notations.
-
- (Object) dependencies=(dependencies)
Set dependencies.
-
- (Maven) initialize(pom_path = nil)
constructor
Create new instance.
-
- (Object) load_naether(naether)
Load dependencies and remote repo from a Naether instance.
-
- (Object) notation=(notation)
Set the Notation for this Project.
-
- (Object) repositories=(repositories)
Set repositories.
-
- (Object) version
Get the version.
-
- (Object) write_pom(file_path)
Write Maven Pom.
Constructor Details
- (Maven) initialize(pom_path = nil)
Create new instance
51 52 53 54 55 56 57 58 |
# File 'lib/naether/maven.rb', line 51 def initialize(pom_path = nil) if pom_path @project = Naether::Java.create("com.tobedevoured.naether.maven.Project", pom_path ) else @project = Naether::Java.create("com.tobedevoured.naether.maven.Project" ) end end |
Class Method Details
+ (Naether::Maven) create_from_notation(notation)
Create an instance based on notation
41 42 43 44 45 |
# File 'lib/naether/maven.rb', line 41 def create_from_notation( notation ) maven = Maven.new maven.notation = notation maven end |
+ (Naether::Maven) create_from_pom(pom_path)
Create an instance from a POM
32 33 34 |
# File 'lib/naether/maven.rb', line 32 def create_from_pom( pom_path ) maven = Maven.new( pom_path ) end |
Instance Method Details
- (Object) add_dependency(notation, scope = nil)
Add dependency by scope
105 106 107 |
# File 'lib/naether/maven.rb', line 105 def add_dependency( notation, scope = nil ) @project.addDependency( notation, scope ) end |
- (String) build_pom
Create the XML for a Maven Pom
140 141 142 |
# File 'lib/naether/maven.rb', line 140 def build_pom() @project.toXml() end |
- (Object) dependencies(scopes = nil)
Get dependences for Project as notations
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/naether/maven.rb', line 71 def dependencies( scopes = nil) if scopes unless scopes.is_a? Array scopes = [scopes] end end if Naether.platform == 'java' if scopes.nil? deps = @project.getDependenciesNotation() else deps = @project.getDependenciesNotation( scopes ) end else list = nil if scopes list = Naether::Java.convert_to_java_list( scopes ) deps = @project._invoke('getDependenciesNotation', 'Ljava.util.List;', list) else deps = @project.getDependenciesNotation() end end Naether::Java.convert_to_ruby_array( deps, true ) end |
- (Object) dependencies=(dependencies)
Set dependencies
113 114 115 |
# File 'lib/naether/maven.rb', line 113 def dependencies=(dependencies) @project.setDependencies( dependencies ) end |
- (Object) load_naether(naether)
Load dependencies and remote repo from a Naether instance
132 133 134 135 |
# File 'lib/naether/maven.rb', line 132 def load_naether( naether ) self.dependencies= naether.resolver.currentDependencies() self.repositories= naether.resolver.getRemoteRepositoryUrls() end |
- (Object) notation=(notation)
Set the Notation for this Project
64 65 66 |
# File 'lib/naether/maven.rb', line 64 def notation=(notation) @project.setProjectNotation( notation ) end |
- (Object) repositories=(repositories)
Set repositories
120 121 122 |
# File 'lib/naether/maven.rb', line 120 def repositories=( repositories ) @project.setRepositories( repositories ) end |
- (Object) version
Get the version
return [String] version
127 128 129 |
# File 'lib/naether/maven.rb', line 127 def version() return @project.getVersion() end |
- (Object) write_pom(file_path)
Write Maven Pom
148 149 150 |
# File 'lib/naether/maven.rb', line 148 def write_pom( file_path ) @project.writePom( file_path ) end |