I would like to know what the best way to use JRuby with maven is ? I
found jbundler and it seems as if jgem can load jars from a central
repository, but what if I need to load the dependencies from another
repository ?
Regards
Roger
I would like to know what the best way to use JRuby with maven is ? I
found jbundler and it seems as if jgem can load jars from a central
repository, but what if I need to load the dependencies from another
repository ?
Regards
Roger
you can add
repository ‘http://…’
to your Jarfile to declare another maven repository beside maven
central.
but if you want to use maven with jruby than have a look at
jbundler is a way to add jar dependencies to your jruby project.
regards,
Kristian
PS I am just about to update the jbundler readme about the repo
declaration
If you are looking for dependency resolution, I wrote
GitHub - mguymon/lock_jar: LockJar manages Java Jars for Ruby as a Frankenstein between Maven and
Bundler for JRuby. Similar to Bundler, you create a Jarfile with Jar
specific properties. An example Jarfile:
repository
'http://repository.jboss.org/nexus/content/groups/public-jboss'
# default scope is compile
jar "org.apache.mina:mina-core:2.0.4"
scope 'runtime' do
jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
end
scope 'test' do
jar 'junit:junit:jar:4.10'
end
By calling LockJar.lock, all the Jar dependencies are resolved and
downloaded using Maven’s Aether lib and generates the lockfile. An
example lockfile:
---
repositories:
- http://repository.jboss.org/nexus/content/groups/public-jboss
scopes:
compile:
dependencies:
- org.apache.mina:mina-core:2.0.4
resolved_dependencies:
- org.apache.mina:mina-core:jar:2.0.4
- org.slf4j:slf4j-api:jar:1.6.1
- com.slackworks:modelcitizen:jar:0.2.2
- commons-lang:commons-lang:jar:2.6
- commons-beanutils:commons-beanutils:jar:1.8.3
- commons-logging:commons-logging:jar:1.1.1
- ch.qos.logback:logback-classic:jar:0.9.24
- ch.qos.logback:logback-core:jar:0.9.24
- com.metapossum:metapossum-scanner:jar:1.0
- commons-io:commons-io:jar:1.4
- junit:junit:jar:4.7
runtime:
dependencies:
- org.apache.tomcat:servlet-api:jar:6.0.35
resolved_dependencies:
- org.apache.tomcat:servlet-api:jar:6.0.35
test:
dependencies:
- junit:junit:jar:4.10
resolved_dependencies:
- junit:junit:jar:4.10
- org.hamcrest:hamcrest-core:jar:1.1
Finally, to load the classpath once you have a lockfile, you simply call
LockJar.load. You can specify which scopes you want loaded by passing in
an array of scope names, e.g. LockJar.load( [‘runtime’, ‘test’] ).
LockJar defaults to the runtime and compile scopes.
You can actually skip the Jarfile and lockfile process by having the
LockJar.load resolve dependences with the :resolve => true parameter and
passing in a Jarfile config as the block. An example:
LockJar.load( :resolve => true ) do
jar
‘org.eclipse.jetty:example-jetty-embedded:jar:8.1.2.v20120308’
end
LockJar also can integrate directly with Bundler and Buildr.
–M
Thanks,
worked like a charm.
Regards
Roger
Am 04.08.2012 um 04:05 schrieb Michel G. [email protected]:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs