Buildr Resolver
A Java dependency resolver for Buildr using Maven’s Aether via the wrapper Naether.
github.com/mguymon/buildr-resolver
Get Started
Install
gem install buildr-resolver
Examples
Usage
The Buildr::Resolver.resolve(deps)
is what takes the dependency notation and find all the related dependencies. For exampe, resolving org.apache.activemq:activemq-spring:jar:5.4.2
would resolve to:
org.apache.activemq:activemq-spring:jar:5.4.2
commons-logging:commons-logging-api:jar:1.1
org.apache.activemq:activemq-core:jar:5.4.2
org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1
org.apache.activemq:activeio-core:jar:3.1.2
commons-logging:commons-logging:jar:1.1
log4j:log4j:jar:1.2.12
logkit:logkit:jar:1.0.1
(many more)
Buildr::Resolver#resolve
The Buildr::Resolver#resolve
accepts an array of dependencies in the format of:
-
Path to a pom.xml:
'lib/pom.xml'
-
A hash for a pom.xml and scopes to use:
'lib/pom.xml' => ['compile','system']
-
Dependency notation:
'log4j:log4j:jar:1.2.12'
-
A hash for a Dependency notation and scope to use:
'log4j:log4j:jar:1.2.12' => ['compile']
Options
* :excludes - an array of dependencies to regex exclude
* :download - have Buildr::Resolver download artifacts instead of Buildr
Example:
Buildr::Resolver.resolve( [ {'lib/pom.xml' => ["test"] }, 'ch.qos.logback:logback-classic:jar:0.9.24', {'junit:junit:jar:4.8.2' => 'test'} ], :download => true )
Resolve Dependencies
require 'buildr/resolver'
Java.load # must be called before Buildr::Resolver.resolve if not using JRuby due to Rjb startup of JVM by Buildr
deps = ['org.apache.activemq:activemq-spring:jar:5.4.2']
deps = Buildr::Resolver.resolve( deps )
define 'example' do
project.version = '0.1.0'
compile.with deps
package :jar
end
Resolve Dependencies from a POM
require 'buildr/resolver'
Java.load # must be called before Buildr::Resolver.resolve if not using JRuby due to Rjb startup of JVM by Buildr
task :compile => :resolve_deps
task :resolve_deps do |t|
DEP_EXCLUDES = ['commons-logging', 'log4j', 'logkit']
resolved_deps = Buildr::Resolver.resolve( {_('pom.xml') => ['compile']}, :download => true, :excludes => DEP_EXCLUDES )
compile.with( resolved_deps )
end
License
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.