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)
-
- (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
- (String) build_pom
Create the XML for a Maven Pom
130 131 132 |
# File 'lib/naether/maven.rb', line 130 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
103 104 105 |
# File 'lib/naether/maven.rb', line 103 def dependencies=(dependencies) @project.setDependencies( dependencies ) end |
- (Object) load_naether(naether)
Load dependencies and remote repo from a Naether instance
122 123 124 125 |
# File 'lib/naether/maven.rb', line 122 def load_naether( naether ) self.dependencies= naether.resolver.getDependencies() 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
110 111 112 |
# File 'lib/naether/maven.rb', line 110 def repositories=( repositories ) @project.setRepositories( repositories ) end |
- (Object) version
Get the version
return [String] version
117 118 119 |
# File 'lib/naether/maven.rb', line 117 def version() return @project.getVersion() end |
- (Object) write_pom(file_path)
Write Maven Pom
138 139 140 |
# File 'lib/naether/maven.rb', line 138 def write_pom( file_path ) @project.writePom( file_path ) end |