Class: LockJar::Maven
- Inherits:
-
Object
- Object
- LockJar::Maven
- Defined in:
- lib/lock_jar/maven.rb
Overview
Helper for providing Maven specific operations
Class Method Summary collapse
-
.dependencies(pom_path, scopes = %w(compile runtime))) ⇒ String
Get dependencies of a Pom.
-
.deploy_artifact(notation, file_path, url, deploy_opts = {}, lockjar_opts = {}) ⇒ Object
Deploy an artifact to a Maven repository.
-
.install(notation, pom_path, jar_path, opts = {}) ⇒ Object
Install an artifact to a local repository.
-
.pom_version(pom_path) ⇒ String
Get the version of a POM.
-
.write_pom(notation, file_path, opts = {}) ⇒ Object
Write a POM from list of notations.
Class Method Details
.dependencies(pom_path, scopes = %w(compile runtime))) ⇒ String
Get dependencies of a Pom
45 46 47 48 |
# File 'lib/lock_jar/maven.rb', line 45 def dependencies(pom_path, scopes = %w(compile runtime)) maven = Naether::Maven.create_from_pom(pom_path) maven.dependencies(scopes) end |
.deploy_artifact(notation, file_path, url, deploy_opts = {}, lockjar_opts = {}) ⇒ Object
Deploy an artifact to a Maven repository
94 95 96 97 |
# File 'lib/lock_jar/maven.rb', line 94 def deploy_artifact(notation, file_path, url, deploy_opts = {}, lockjar_opts = {}) Runtime.instance.resolver(lockjar_opts).naether.deploy_artifact( notation, file_path, url, deploy_opts) end |
.install(notation, pom_path, jar_path, opts = {}) ⇒ Object
Install an artifact to a local repository
107 108 109 |
# File 'lib/lock_jar/maven.rb', line 107 def install(notation, pom_path, jar_path, opts = {}) Runtime.instance.resolver(opts).naether.install(notation, pom_path, jar_path) end |
.pom_version(pom_path) ⇒ String
Get the version of a POM
32 33 34 35 |
# File 'lib/lock_jar/maven.rb', line 32 def pom_version(pom_path) maven = Naether::Maven.create_from_pom(pom_path) maven.version end |
.write_pom(notation, file_path, opts = {}) ⇒ Object
Write a POM from list of notations
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/lock_jar/maven.rb', line 62 def write_pom(notation, file_path, opts = {}) opts = { include_resolved: true }.merge(opts) maven = Naether::Maven.create_from_notataion(notation) if opts[:include_resolved] # Passes in nil to the resolver to get the cache maven.load_naether(Runtime.instance.resolver.naether) end if opts[:dependencies] opts[:dependencies].each do |dep| if dep.is_a? Array maven.add_dependency(dep[0], dep[1]) else maven.add_dependency(dep) end end end maven.write_pom(file_path) end |