-
Notifications
You must be signed in to change notification settings - Fork 7
Gem Artifacts
Maven Gem Artifacts are regular maven artifacts with type gem.
Rubygems are either released or prereleased. the problem is that the released gems can have dependencies to prereleased gems ! putting all gems into one repository would mean that you always pick prereleased gems when possible, like installing gems with --prerelease
flag set.
there are two repositories on all rubygems repositories under the path /maven/releases and /maven/prereleases for all three types of repositories (hosted, proxy, group).
this releases will serve all gems when picked with their version like
<dependency>
<groupId>rubygems</groupId>
<artifactId>maven-tools</artifactId>
<version>1.0.0.rc3</version>
<type>gem</type>
</dependency>
or
<dependency>
<groupId>rubygems</groupId>
<artifactId>maven-tools</artifactId>
<version>1.0.0</version>
<type>gem</type>
</dependency>
othwewise version ranges will pick only released gems ! something like this
<dependency>
<groupId>rubygems</groupId>
<artifactId>maven-tools</artifactId>
<version>[1.0.0,)</version>
<type>gem</type>
</dependency>
will only consider released gems. the maven-metadata.xml of any Gem-Artifact only contains versions of released gems.
with this repository you can have both released as well prereleased gems in your project and still give preference to released gems inside transitive dependency hull.
this is repository with all the prereleased gems and they all show up in the respective maven-metadata.xml.
if there is a gem A which uses some prereleased gem via >= 0.9.0.rc5 then the prereleased repository is added to pom.xml of gem A. this constraint will be translated by maven to [0.9.0.rc5-SNAPSHOT,). if there is only the gem with 0.9.0.rc5 then maven will find it. the only drawback it that the prereleaed repository is hardcoded to http://rubygems-proxy.torquebox.org/prereleases/
so you need a mirror setup in your settings.xml
this mirror setup can is needed to ensure your gems are deliverd from nexus. assuming a rubygems repository under http://localhost:8081/nexus/content/repositories/gems
<settings>
<mirrors>
<mirror>
<id>gems</id>
<name>Rubygems</name>
<url>http://localhost:8081/nexus/content/repositories/gems/maven/releases</url>
<mirrorOf>rubygems-releases</mirrorOf>
</mirror>
<mirror>
<id>pregems</id>
<name>Rubygems Prereleases</name>
<url>http://localhost:8081/nexus/content/repositories/gems/maven/prereleases</url>
<mirrorOf>rubygems-prereleases</mirrorOf>
</mirror>
important the mirrorOf ids need to use those values since they need to match the ids in the generated pom.xml.
for your maven project you need to add this:
<repositories>
<repository>
<id>rubygems-releases</id>
<url>http://rubygems-proxy.torquebox.org/releases</url>
</repository>
now maven can resolve Gem-Artifacts via your nexus rubygems repository.
since the Gem Artifacts are part of the Rubygems Repositories on Nexus they can not participate with a Group Maven Repository. in order to achieve this you just need to proxy using the path the Maven part of the Rubygems Repository, i.e. http://localhost:8081/nexus/content/repositories/gems/maven/releases
this Maven Proxy can be used like any other Maven Repository inside Nexus.