-
Notifications
You must be signed in to change notification settings - Fork 1
Home
mguymon edited this page Oct 28, 2011
·
11 revisions
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
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
Access a remote repository that requires auth using the :repo option:
require 'buildr/resolver'
Java.load # must be called before Buildr::Resolver.resolve if not using JRuby due to Rjb startup of JVM by Buildr
repositories.remote << { :url => 'http://somewhere.repo/m2', :username => 'username', :password => 'password' }
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
Exclude commons-logging from the dependencies used in the project using the :excludes option:
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, :excludes => ['commons-logging'] )
define 'example' do
project.version = '0.1.0'
compile.with deps
package :jar
end
Example task to write a POM based on the project. All dependencies loaded by Buildr::Resolver.resolve are included.
task :pom do |t|
Buildr::Resolver.write_pom( "com.slackworks:buildr-resolver:jar:0.1, 'pom.xml' )
end