naether 0.8.6-java → 0.9.0-java

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # Naether
2
+
3
+ Naether is a Java Dependency Resolver using Maven's [Aether](https://github.com/sonatype/sonatype-aether)
4
+ that can be used by Ruby or Java.
5
+
6
+ <https://github.com/mguymon/naether>
7
+
8
+ [RDoc](http://rubydoc.info/gems/naether/frames) | [JavaDoc](http://mguymon.github.com/naether/apidocs/index.html) | [Wiki](https://github.com/mguymon/naether/wiki)
9
+
10
+ ## Install
11
+
12
+ ### Ruby
13
+
14
+ JRuby 1.6.7 is natively supported. Ruby 1.8.7 and 1.9.3 use [Rjb](http://rjb.rubyforge.org) to proxy over JNI.
15
+
16
+ gem install naether
17
+
18
+ The jar dependencies for Naether will automatically be downloaded when the gem installs.
19
+
20
+ ### Java
21
+
22
+ <dependency>
23
+ <groupId>com.tobedevoured.naether</groupId>
24
+ <artifactId>naether</artifactId>
25
+ <version>0.9.0</version>
26
+ </dependency>
27
+
28
+ May have to add the Sonatype Repo if the sync to Maven Central is slow.
29
+
30
+ <repositories>
31
+ <repository>
32
+ <id>oss.sonatype.org</id>
33
+ <name>Sonatype Repository</name>
34
+ <url>https://oss.sonatype.org/content/groups/public</url>
35
+ </repository>
36
+ </repositories>
37
+
38
+ ## Usage
39
+
40
+ ### Ruby
41
+
42
+ All of the Naether dependencies are loaded via a Custom ClassLoader.
43
+
44
+ #### Bootstraping
45
+
46
+ Naether [jar dependences](https://github.com/mguymon/naether/blob/master/jar_dependencies.yml)
47
+ must be loaded for Naether to work. This is easily done with the [bootstrap helper](http://rdoc.info/gems/naether/Naether/Bootstrap)
48
+
49
+ Naether::Bootstrap.bootstrap_local_repo
50
+
51
+ #### Resolving Dependencies
52
+
53
+ require 'rubygems
54
+ require 'naether'
55
+
56
+ Naether::Bootstrap.bootstrap_local_repo
57
+ naether = Naether.new
58
+ naether.dependencies = [ "ch.qos.logback:logback-classic:jar:0.9.29", "junit:junit:jar:4.8.2" ]
59
+ naether.resolve_dependencies().
60
+
61
+ puts naether.dependences_notation
62
+
63
+ Will output
64
+
65
+ ["ch.qos.logback:logback-core:jar:0.9.29",
66
+ "ch.qos.logback:logback-classic:jar:0.9.29",
67
+ "junit:junit:jar:4.8.2",
68
+ "org.slf4j:slf4j-api:jar:1.6.1" ]
69
+
70
+ [Additional documentation on Resolving Dependencies](https://github.com/mguymon/naether/wiki/Ruby-Resolving-Dependencies)
71
+
72
+ ### Java
73
+
74
+ #### Resolving Dependencies
75
+
76
+ Naether naether = new Naether();
77
+ naether.addDependency( "ch.qos.logback:logback-classic:jar:0.9.29" );
78
+ naether.addDependency( "junit:junit:jar:4.8.2" );
79
+ naether.resolveDependencies();
80
+ System.out.println( naether.getDependenciesNotation().toString() );
81
+
82
+ Will output:
83
+
84
+ ["ch.qos.logback:logback-core:jar:0.9.29",
85
+ "ch.qos.logback:logback-classic:jar:0.9.29",
86
+ "junit:junit:jar:4.8.2",
87
+ "org.slf4j:slf4j-api:jar:1.6.1" ]
88
+
89
+ [Additional documentation on Resolving Dependencies](https://github.com/mguymon/naether/wiki/Java-Resolving-Dependencies)
90
+
91
+ ## License
92
+
93
+ Licensed to the Apache Software Foundation (ASF) under one or more
94
+ contributor license agreements. See the NOTICE file distributed with this
95
+ work for additional information regarding copyright ownership. The ASF
96
+ licenses this file to you under the Apache License, Version 2.0 (the
97
+ "License"); you may not use this file except in compliance with the License.
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software
103
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
104
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
105
+ License for the specific language governing permissions and limitations under
106
+ the License.
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ task :default => :prepare
2
+
3
+ task :prepare do
4
+ $:.unshift File.expand_path('../lib', __FILE__)
5
+ require 'naether/bootstrap'
6
+ require 'fileutils'
7
+
8
+ puts "Installing Jar Dependencies"
9
+ Naether::Bootstrap.bootstrap_local_repo
10
+
11
+ puts "Removing temp dir"
12
+ temp_dir = File.join( Naether::Bootstrap.default_local_repo, ".naether" )
13
+ FileUtils.rm_rf( temp_dir )
14
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.6
1
+ 0.9.0
data/jar_dependencies.yml CHANGED
@@ -1,39 +1,33 @@
1
1
  ---
2
2
  :dependencies:
3
+ - ch.qos.logback:logback-classic:jar:1.0.6
4
+ - ch.qos.logback:logback-core:jar:1.0.6
3
5
  - com.jcraft:jsch:jar:0.1.44-1
4
6
  - com.ning:async-http-client:jar:1.6.5
5
- - org.apache.xbean:xbean-reflect:jar:3.4
6
- - com.google.collections:google-collections:jar:1.0
7
- - ch.qos.logback:logback-classic:jar:0.9.29
8
- - ch.qos.logback:logback-core:jar:0.9.29
9
- - org.slf4j:slf4j-api:jar:1.6.2
10
- - org.slf4j:jcl-over-slf4j:jar:1.6.2
11
- - org.slf4j:log4j-over-slf4j:jar:1.6.2
12
- - org.sonatype.aether:aether-api:jar:1.13
13
- - org.sonatype.aether:aether-util:jar:1.13
14
- - org.sonatype.aether:aether-impl:jar:1.13
15
- - org.sonatype.aether:aether-spi:jar:1.13
16
- - org.sonatype.aether:aether-connector-file:jar:1.13
17
- - org.sonatype.aether:aether-connector-asynchttpclient:jar:1.13
18
- - org.sonatype.aether:aether-connector-wagon:jar:1.13
19
- - org.sonatype.sisu:sisu-inject-bean:jar:2.2.3
20
- - org.sonatype.sisu:sisu-inject-plexus:jar:2.2.3
21
- - org.apache.maven:maven-model-v3:jar:2.0
7
+ - commons-io:commons-io:jar:2.0.1
22
8
  - org.apache.maven:maven-aether-provider:jar:3.0.3
23
9
  - org.apache.maven:maven-model:jar:3.0.3
24
10
  - org.apache.maven:maven-model-builder:jar:3.0.3
25
11
  - org.apache.maven:maven-repository-metadata:jar:3.0.3
26
- - org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6
27
- - org.apache.maven.wagon:wagon-ssh-common:jar:1.0
12
+ - org.apache.maven.wagon:wagon-file:jar:1.0
28
13
  - org.apache.maven.wagon:wagon-http-lightweight:jar:1.0
29
14
  - org.apache.maven.wagon:wagon-http-shared:jar:1.0
15
+ - org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6
30
16
  - org.apache.maven.wagon:wagon-ssh:jar:1.0
31
- - org.apache.maven.wagon:wagon-file:jar:1.0
32
- - org.codehaus.plexus:plexus-utils:jar:3.0
33
- - org.codehaus.plexus:plexus-container-default:jar:1.5.5
34
- - org.codehaus.plexus:plexus-classworlds:jar:2.2.2
17
+ - org.apache.maven.wagon:wagon-ssh-common:jar:1.0
18
+ - org.codehaus.plexus:plexus-classworlds:jar:2.4
35
19
  - org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
36
- - org.codehaus.plexus:plexus-interpolation:jar:1.14
37
20
  - org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-6
38
- - commons-io:commons-io:jar:2.0.1
21
+ - org.codehaus.plexus:plexus-interpolation:jar:1.14
22
+ - org.codehaus.plexus:plexus-utils:jar:2.0.7
39
23
  - org.jsoup:jsoup:jar:1.6.1
24
+ - org.slf4j:slf4j-api:jar:1.6.6
25
+ - org.slf4j:jcl-over-slf4j:jar:1.6.6
26
+ - org.slf4j:log4j-over-slf4j:jar:1.6.6
27
+ - org.sonatype.aether:aether-api:jar:1.13.1
28
+ - org.sonatype.aether:aether-util:jar:1.13.1
29
+ - org.sonatype.aether:aether-impl:jar:1.13.1
30
+ - org.sonatype.aether:aether-spi:jar:1.13.1
31
+ - org.sonatype.aether:aether-connector-file:jar:1.13.1
32
+ - org.sonatype.aether:aether-connector-asynchttpclient:jar:1.13.1
33
+ - org.sonatype.aether:aether-connector-wagon:jar:1.13.1
data/lib/naether.rb CHANGED
@@ -1,63 +1,63 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ require "#{File.dirname(__FILE__)}/naether/configuration"
1
17
  require "#{File.dirname(__FILE__)}/naether/bootstrap"
2
18
  require "#{File.dirname(__FILE__)}/naether/java"
3
19
 
4
- # :title:Naether
5
- #
6
- # Java dependency resolver using Maven's Aether.
20
+
21
+ # Java dependency resolver.
7
22
  #
8
- # = Authors
9
- # Michael Guymon
23
+ # @author Michael Guymon
10
24
  #
11
25
  class Naether
12
26
 
13
- # Naether jar path will default to packaged in the gem
14
- JAR_LIB = "#{File.dirname(__FILE__)}/.."
15
-
16
- # Load VERSION file to VERSION var
17
- if File.exists?( File.join( JAR_LIB, "VERSION" ) )
18
- VERSION = File.open( File.join( JAR_LIB, "VERSION" ) ) {|f| f.readline }.strip
19
-
20
- # VERSION file not found in gem dir, assume running from checkout
21
- else
22
- VERSION = File.open( "VERSION" ) {|f| f.readline }.strip
23
- end
24
-
25
- # Use the VERSION to create jar file name
26
- JAR_PATH = "#{JAR_LIB}/naether-#{VERSION}.jar"
27
+ attr_reader :resolver
27
28
 
28
29
  class << self
29
30
 
30
- # Helper to determine the platform
31
- def platform
32
- $platform || RUBY_PLATFORM[/java/] || 'ruby'
33
- end
34
-
35
- # Java dependencies needed to bootstrap Naether
31
+ # Helper for Java dependencies needed to bootstrap Naether
32
+ #
33
+ # @param [String] dep_file path
34
+ # @see {Naether::Bootstrap#dependencies}
36
35
  def bootstrap_dependencies( dep_file=nil )
37
36
  Naether::Bootstrap.dependencies( dep_file )
38
37
  end
39
38
 
40
- # Loads all jars from paths and creates a new instance of Naether
41
- def create_from_paths( deps_jar_dir, naether_jar_dir = nil )
42
- naether_jar_dir = naether_jar_dir || JAR_LIB
43
- Naether::Java.load_jars_dir( [deps_jar_dir, naether_jar_dir] )
44
-
45
- Naether.new
39
+ #
40
+ # Helper for platform detection
41
+ #
42
+ def platform
43
+ Naether::Configuration.platform
46
44
  end
47
45
 
46
+ #
48
47
  # Loads all jars creates a new instance of Naether
48
+ #
49
+ # @param [Array<String>] jars of paths
50
+ # @return [Naether]
49
51
  def create_from_jars( jars )
50
- Naether::Java.load_jars( jars )
51
-
52
+ Naether::Java.internal_load_paths( jars )
52
53
  Naether.new
53
54
  end
54
55
 
55
56
  end
56
57
 
57
- # Create new instance. Naether.create_from_paths and Naether.create_from_jars should be
58
- # used instead of Naether.new to ensure the dependencies for Naether are set into the classpath
58
+ # Create new instance.
59
59
  def initialize
60
- @resolver = Naether::Java.create('com.slackworks.naether.Naether')
60
+ @resolver = Naether::Java.create('com.tobedevoured.naether.Naether')
61
61
  end
62
62
 
63
63
  # Clear all remote repositories
@@ -66,6 +66,10 @@ class Naether
66
66
  end
67
67
 
68
68
  # Add remote repository
69
+ #
70
+ # @param [String] url of remote repo
71
+ # @param [String] username optional
72
+ # @param [String] password optioanl
69
73
  def add_remote_repository( url, username = nil, password = nil )
70
74
  if username
71
75
  @resolver.addRemoteRepositoryByUrl( url, username, password )
@@ -74,29 +78,50 @@ class Naether
74
78
  end
75
79
  end
76
80
 
77
- # Array of remote repositories
81
+ # Get remote repositories
82
+ #
83
+ # @return [Array] of remote repos
78
84
  def remote_repositories
79
85
  Naether::Java.convert_to_ruby_array(@resolver.getRemoteRepositories())
80
86
  end
81
87
 
88
+ # Get remote repositories as urls
89
+ #
90
+ # @return [Array<String>] of String urls
82
91
  def remote_repository_urls
83
92
  Naether::Java.convert_to_ruby_array(@resolver.getRemoteRepositoryUrls(), true)
84
93
  end
85
94
 
86
95
  # Path to local maven repo
96
+ #
97
+ # @return [String] path to local repo
87
98
  def local_repo_path
88
99
  @resolver.getLocalRepoPath()
89
100
  end
90
101
 
91
102
  # Set path to local maven repo
103
+ #
104
+ # @param [String] path local repo
92
105
  def local_repo_path=( path )
93
106
  @resolver.setLocalRepoPath( path )
94
107
  end
95
108
 
109
+ #
110
+ # Add a local Build Artifact, that will be used in the Dependency Resolution
111
+ #
112
+ # @param [String] notation
113
+ # @param [String] path to artifact
114
+ # @param [String] pom optional path to pom.xml
115
+ #
96
116
  def add_build_artifact( notation, path, pom = nil )
97
117
  @resolver.addBuildArtifact(notation, path, pom )
98
118
  end
99
119
 
120
+ #
121
+ # Set local Build Artifacts, that will be used in the Dependency Resolution
122
+ #
123
+ # @param [Array<Hash>] artifacts of Hashs with { notation => path } or { notation => { :path => path, :pom => pom_path }
124
+ #
100
125
  def build_artifacts=( artifacts )
101
126
  @resolver.clearBuildArtifacts()
102
127
 
@@ -122,29 +147,40 @@ class Naether
122
147
  end
123
148
  end
124
149
 
150
+ #
151
+ # Get Build Artifacts
152
+ #
153
+ # @return [Array] of build artifacts
154
+ #
125
155
  def build_artifacts
126
156
  Naether::Java.convert_to_ruby_array( @resolver.getBuildArtifacts() )
127
157
  end
128
158
 
129
- # Add a dependency in the notation: groupId:artifactId:type:version
159
+ # Add a dependency
160
+ #
161
+ # @param [String] notation in the format of groupId:artifactId:version
162
+ # @param [String] scope valid options are compile,test,runtime
163
+ # @see https://github.com/mguymon/naether/wiki/Notations
130
164
  def add_notation_dependency( notation, scope='compile' )
131
165
  @resolver.addDependency( notation, scope )
132
166
  end
133
167
 
134
168
  # Add dependencies from a Maven POM
169
+ #
170
+ # @param [String] pom_path
171
+ # @param [Array<String>] scopes valid options are compile,test,runtime
135
172
  def add_pom_dependencies( pom_path, scopes=['compile'] )
136
173
  if Naether.platform == 'java'
137
174
  @resolver.addDependencies( pom_path, scopes )
138
175
  else
139
- list = Rjb::import("java.util.ArrayList").new
140
- scopes.each do |scope|
141
- list.add( scope )
142
- end
176
+ list = Naether::Java.convert_to_java_list( scopes )
143
177
  @resolver._invoke( 'addDependencies', 'Ljava.lang.String;Ljava.util.List;', pom_path, list )
144
178
  end
145
179
  end
146
180
 
147
- # Add a dependency of org.sonatype.aether.graph.Dependency Java object
181
+ # Add a dependency of org.sonatype.aether.graph.Dependency
182
+ #
183
+ # @param [org.sonatype.aether.graph.Dependency] dependency
148
184
  def add_dependency( dependency )
149
185
  #@resolver.addDependency( dependency )
150
186
  if Naether.platform == 'java'
@@ -154,11 +190,16 @@ class Naether
154
190
  end
155
191
  end
156
192
 
157
- # Array of mixed dependencies.
158
- # * Artifact notation in the format of groupId:artifactId:version or groupId:artifactId:type:version - 'junit:junit:4.7'
159
- # * Hash of a single artifaction notation => scope - { 'junit:junit:4.7' => 'test' }
160
- # * Path to a local pom - 'lib/pom.xml'
161
- # * Hash of a single path to a local pom => scope - { 'lib/pom.xml' => ['compile','test'] }
193
+ # Set the dependencies
194
+ #
195
+ # The dependencies param takes an [Array] of mixed dependencies:
196
+ # * [String] Artifact notation, such as groupId:artifactId:version, e.g. 'junit:junit:4.7'
197
+ # * [Hash] of a single artifaction notation => scope - { 'junit:junit:4.7' => 'test' }
198
+ # * [String] path to a local pom - 'lib/pom.xml'
199
+ # * [Hash] of a single path to a local pom => scope - { 'lib/pom.xml' => ['compile','test'] }
200
+ #
201
+ # @param [Array] dependencies
202
+ # @see https://github.com/mguymon/naether/wiki/Notations
162
203
  def dependencies=(dependencies)
163
204
  @resolver.clearDependencies()
164
205
 
@@ -206,22 +247,30 @@ class Naether
206
247
  end
207
248
 
208
249
  # Get array of dependencies
250
+ #
251
+ # @return [Array]
209
252
  def dependencies
210
253
  Naether::Java.convert_to_ruby_array( @resolver.getDependencies() )
211
254
  end
212
255
 
213
256
  # Get array of dependencies as notation
257
+ #
258
+ # @return [Array<String>] of notations
259
+ # @see https://github.com/mguymon/naether/wiki/Notations
214
260
  def dependencies_notation
215
261
  Naether::Java.convert_to_ruby_array(@resolver.getDependenciesNotation(), true)
216
262
  end
217
- alias_method :dependenciesNotation, :dependencies_notation # some javaism snuck in
218
263
 
219
264
  # Hash of dependency paths
265
+ #
266
+ # @return [Array<Hash>] of { notation => path }
220
267
  def dependencies_path
221
268
  Naether::Java.convert_to_ruby_hash( @resolver.getDependenciesPath(), true )
222
269
  end
223
270
 
224
271
  # Convert dependencies to Classpath friendly string
272
+ #
273
+ # @return [String]
225
274
  def dependencies_classpath()
226
275
  @resolver.getResolvedClassPath()
227
276
  end
@@ -234,7 +283,10 @@ class Naether
234
283
  jars
235
284
  end
236
285
 
237
- # Resolve dependencies, finding related additional dependencies
286
+ # Resolve dependencies
287
+ #
288
+ # @return [Array<String>] of notations
289
+ # @see https://github.com/mguymon/naether/wiki/Notations
238
290
  def resolve_dependencies( download_artifacts = true, properties = nil )
239
291
 
240
292
  if properties
@@ -246,24 +298,37 @@ class Naether
246
298
  end
247
299
 
248
300
  @resolver.resolveDependencies( download_artifacts, map );
249
- dependenciesNotation
301
+ dependencies_notation
250
302
  end
251
303
 
304
+ # Convert notations to local paths of artifacts
305
+ #
306
+ # @param [Array<String>] notations
307
+ # @return [Array<String>] of paths to artifacts
308
+ # @see https://github.com/mguymon/naether/wiki/Notations
252
309
  def to_local_paths( notations )
253
310
  if Naether.platform == 'java'
254
- Naether::Java.convert_to_ruby_array( @resolver.getLocalPaths( notations ) )
311
+ Naether::Java.convert_to_ruby_array(
312
+ Naether::Java.exec_static_method(
313
+ 'com.tobedevoured.naether.util.Notation',
314
+ 'getLocalPaths',
315
+ [local_repo_path, notations ],
316
+ ['java.lang.String', 'java.util.List'] ) )
255
317
  else
256
- list = Rjb::import("java.util.ArrayList").new
257
- notations.each do |notation|
258
- list.add( notation )
259
- end
260
- paths = @resolver._invoke('getLocalPaths', 'Ljava.util.List;', list)
261
-
318
+ paths = Naether::Java.exec_static_method(
319
+ 'com.tobedevoured.naether.util.Notation',
320
+ 'getLocalPaths',
321
+ [local_repo_path, Naether::Java.convert_to_java_list(notations) ],
322
+ ['java.lang.String', 'java.util.List'] )
262
323
  Naether::Java.convert_to_ruby_array( paths, true )
263
324
  end
264
325
 
265
326
  end
266
-
327
+
328
+ # Download artifacts
329
+ #
330
+ # @param [Array<String>] notations
331
+ # @return [Array<String>] of paths of downloaded artifacts
267
332
  def download_artifacts( notations )
268
333
  if( notations.is_a? String )
269
334
  notations = [notations]
@@ -273,11 +338,7 @@ class Naether
273
338
  if Naether.platform == 'java'
274
339
  files = @resolver.downloadArtifacts( notations )
275
340
  else
276
- list = Rjb::import("java.util.ArrayList").new
277
- notations.each do |notation|
278
- list.add( notation )
279
- end
280
-
341
+ list = Naether::Java.convert_to_java_list( notations )
281
342
  files = @resolver._invoke('downloadArtifacts', 'Ljava.util.List;', list)
282
343
  end
283
344
 
@@ -291,8 +352,18 @@ class Naether
291
352
 
292
353
 
293
354
  # Deploy artifact to remote repo url
355
+ #
356
+ # @param [String] notation
357
+ # @param [String] file_path to artifact to deploy
358
+ # @param [String] url to deploy to
359
+ # @opts [Hash] opts
360
+ # @option opts [String] :pom_path path to pom.xml
361
+ # @option opts [String] :username for optional auth
362
+ # @option opts [String] :password for optional auth
363
+ # @option opts [String] :pub_key for optional auth
364
+ # @option opts [String] :pub_key_passphrase for optional auth
294
365
  def deploy_artifact( notation, file_path, url, opts = {} )
295
- artifact = Naether::Java.create( "com.slackworks.naether.deploy.DeployArtifact" )
366
+ artifact = Naether::Java.create( "com.tobedevoured.naether.deploy.DeployArtifact" )
296
367
 
297
368
  artifact.setRemoteRepo( url )
298
369
  artifact.setNotation( notation )
@@ -304,92 +375,26 @@ class Naether
304
375
  if opts[:username] || opts[:pub_key]
305
376
  artifact.setAuth(opts[:username], opts[:password], opts[:pub_key], opts[:pub_key_passphrase] )
306
377
  end
307
-
308
- @resolver.deployArtifact(artifact)
309
- end
310
-
311
- # Install artifact or pom to local repo, must specify pom_path and/or jar_path
312
- def install( notation, pom_path =nil, jar_path = nil )
313
- @resolver.install(notation, pom_path, jar_path)
314
- end
315
-
316
- def load_pom( file_path )
317
- @project_instance = Naether::Java.create("com.slackworks.naether.maven.Project", file_path )
318
- end
319
-
320
- def pom_dependencies( file_path=nil, scopes = nil)
321
- if file_path
322
- load_pom( file_path )
323
- end
324
-
325
378
  if Naether.platform == 'java'
326
- if scopes.nil?
327
- deps = @project_instance.getDependenciesNotation()
328
- else
329
- deps = @project_instance.getDependenciesNotation( scopes )
330
- end
331
-
379
+ @resolver.deployArtifact(artifact)
332
380
  else
333
- list = nil
334
- if scopes
335
- list = Rjb::import("java.util.ArrayList").new
336
- scopes.each do |scope|
337
- list.add( scope )
338
- end
339
-
340
- deps = @project_instance._invoke('getDependenciesNotation', 'Ljava.util.List;', list)
341
- else
342
- deps = @project_instance.getDependenciesNotation()
343
- end
344
-
345
- end
346
-
347
- Naether::Java.convert_to_ruby_array(@project_instance.getRepositoryUrls()).each do |url|
348
- add_remote_repository( url )
381
+ @resolver._invoke( 'deployArtifact', 'Lcom.tobedevoured.naether.deploy.DeployArtifact;', artifact )
349
382
  end
350
-
351
- Naether::Java.convert_to_ruby_array( deps, true )
352
383
  end
353
384
 
354
- # Get the POM version
355
- def pom_version( file_path=nil )
356
- if file_path
357
- load_pom( file_path )
358
- end
359
-
360
- return @project_instance.getVersion()
361
- end
362
-
363
- # Create the XML for a Maven Pom for the notation, groupId:artifactId:type:version
385
+ # Install artifact or pom to local repo, must specify pom_path and/or jar_path
364
386
  #
365
- # loads all resolved dependencies into pom
366
- def build_pom( notation )
367
- @project_instance = Naether::Java.create("com.slackworks.naether.maven.Project")
368
- @project_instance.setProjectNotation( notation )
369
-
370
- @project_instance.setRepositories( @resolver.getRemoteRepositoryUrls() )
371
-
372
- @project_instance.setDependencies( @resolver.getDependencies() )
373
-
374
- @project_instance.toXml()
375
-
387
+ # @param [String] notation
388
+ # @param [String] pom_path
389
+ # @param [String] jar_path
390
+ def install( notation, pom_path =nil, jar_path = nil )
391
+ @resolver.install(notation, pom_path, jar_path)
376
392
  end
377
393
 
378
- # notation of the pom, groupId:artifactId:type:version
379
- # filePath to write the pom
394
+ # Set Log level for Naether Java logging
380
395
  #
381
- # loads all resolved dependencies into pom
382
- def write_pom( notation, file_path )
383
- @project_instance = Naether::Java.create("com.slackworks.naether.maven.Project")
384
- @project_instance.setProjectNotation( notation )
385
-
386
- @project_instance.setDependencies( @resolver.getDependencies() )
387
-
388
- @project_instance.writePom( file_path )
389
-
390
- end
391
-
396
+ # @param [String] level to debug, info, warn, or error
392
397
  def set_log_level( level )
393
- Naether::Java.java_class('com.slackworks.naether.util.LogUtil').changeLevel( 'com.slackworks', level )
398
+ Naether::Java.exec_static_method('com.tobedevoured.naether.util.LogUtil', 'changeLevel', ['com.tobedevoured', level] )
394
399
  end
395
400
  end