You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Christoph Kiehl <ch...@sulu3000.de> on 2007/04/18 11:33:38 UTC

Using snapshot builds with maven guide

Hi,

I recently tried using the jackrabbit snapshot build from 
http://people.apache.org/repo/m2-snapshot-repository/org/apache/jackrabbit/. One 
problem I discovered is that in the POM for jackrabbit-core for example there 
are no versions for jackrabbit dependencies like jackrabbit-api defined. This 
leads maven to search for an jackrabbit-api artifact with the same version 
number as the jackrabbit-core artifact. This works quite well for release 
versions but not for snapshots since they got different build numbers as well as 
dates all the time. To use these snapshots you have to explicitly specify which 
version of for example jackrabbit-api you want to use. Like this:

<dependency>
   <groupId>org.apache.jackrabbit</groupId>
   <artifactId>jackrabbit-core</artifactId>
   <version>1.3-SNAPSHOT</version>
</dependency>
<dependency>
   <groupId>org.apache.jackrabbit</groupId>
   <artifactId>jackrabbit-api</artifactId>
   <version>1.3-SNAPSHOT</version>
</dependency>
<dependency>
   <groupId>org.apache.jackrabbit</groupId>
   <artifactId>jackrabbit-jcr-commons</artifactId>
   <version>1.3-SNAPSHOT</version>
</dependency>
<dependency>
   <groupId>org.apache.jackrabbit</groupId>
   <artifactId>jackrabbit-text-extractors</artifactId>
   <version>1.3-SNAPSHOT</version>
</dependency>

Note that you have to include an slf4j implementation as well. For log4j is 
looks like this:

<dependency>
	<groupId>org.slf4j</groupId>
	<artifactId>slf4j-log4j12</artifactId>
	<version>1.3.1</version>
</dependency>

I hope to save someone going through the same troubles I went through ;)

Cheers,
Christoph


Re: Using snapshot builds with maven guide

Posted by Christoph Kiehl <ch...@sulu3000.de>.
Christoph Kiehl wrote:

> <dependency>
>   <groupId>org.apache.jackrabbit</groupId>
>   <artifactId>jackrabbit-core</artifactId>
>   <version>1.3-SNAPSHOT</version>
> </dependency>
> <dependency>
>   <groupId>org.apache.jackrabbit</groupId>
>   <artifactId>jackrabbit-api</artifactId>
>   <version>1.3-SNAPSHOT</version>
> </dependency>
> <dependency>
>   <groupId>org.apache.jackrabbit</groupId>
>   <artifactId>jackrabbit-jcr-commons</artifactId>
>   <version>1.3-SNAPSHOT</version>
> </dependency>
> <dependency>
>   <groupId>org.apache.jackrabbit</groupId>
>   <artifactId>jackrabbit-text-extractors</artifactId>
>   <version>1.3-SNAPSHOT</version>
> </dependency>

It works even better if you exclude these dependencies like this:

<dependency>
   <groupId>org.apache.jackrabbit</groupId>
   <artifactId>jackrabbit-core</artifactId>
   <version>1.3-SNAPSHOT</version>
   <exclusions>
     <exclusion>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-api</artifactId>
     </exclusion>
     <exclusion>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-jcr-commons</artifactId>
     </exclusion>
     <exclusion>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-text-extractors</artifactId>
     </exclusion>
   </exclusions>
</dependency>
<dependency>
   <groupId>org.apache.jackrabbit</groupId>
   <artifactId>jackrabbit-api</artifactId>
   <version>1.3-SNAPSHOT</version>
</dependency>
<dependency>
   <groupId>org.apache.jackrabbit</groupId>
   <artifactId>jackrabbit-jcr-commons</artifactId>
   <version>1.3-SNAPSHOT</version>
</dependency>
<dependency>
   <groupId>org.apache.jackrabbit</groupId>
   <artifactId>jackrabbit-text-extractors</artifactId>
   <version>1.3-SNAPSHOT</version>
</dependency>

This guides maven not trying to download poms for the non-existent 
artifact-versions.

Cheers,
Christoph


Re: Using snapshot builds with maven guide

Posted by Christoph Kiehl <ch...@sulu3000.de>.
Jukka Zitting wrote:

> Ah, perhaps Maven is using a single timestamp for the entire
> multimodule build and deploy process. The sequence numbers are managed
> in the maven-metadata.xml files on the snapshot repository. Each
> component has it's own sequence number, which will get out of sync
> from other component sequences whenever someone deploys a snapshot of
> just that component or for example if the multimodule build on the
> Jackrabbit zone fails after already deploying a part of the
> components.

Yes, that sounds reasonable. I wasn't quite sure where the sequence number came 
from, but that explains the behaviour.

>> > Basically I believe Maven should resolve "SNAPSHOT" to the latest
>> > build in the repository and internally still use "SNAPSHOT" as the
>> > version, but I might be mistaken. Perhaps we should replace the
>> > ${version} variables with actual "1.4-SNAPSHOT" version labels in the
>> > dependencyManagement part of the parent POM. I'll look into that.
>>
>> That should actually solve the problem. The problem here is that you 
>> have to
>> update the parent pom on each release.
> 
> That's a small price to pay, as I've in any case used "perl -i -pe
> s/x.y-SNAPSHOT/.../" to do the version updates.

Ok then. Go for it ;)

Cheers,
Christoph


Re: Using snapshot builds with maven guide

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 4/18/07, Christoph Kiehl <ch...@sulu3000.de> wrote:
> Jukka Zitting wrote:
> > The build number that replaces the "SNAPSHOT" part is essentially a
> > timestamp and a sequence number. Since the different components are
> > built and deployed separately, they receive different timestamps and
> > sequence numbers.
>
> Actually it seems like the timestamp is the same for every artifact in the build
> cycle, but the sequence number differs. I think the sequence numbers should be
> the same as well. I don't know why they differ. Maybe one of the subprojects was
> added later?

Ah, perhaps Maven is using a single timestamp for the entire
multimodule build and deploy process. The sequence numbers are managed
in the maven-metadata.xml files on the snapshot repository. Each
component has it's own sequence number, which will get out of sync
from other component sequences whenever someone deploys a snapshot of
just that component or for example if the multimodule build on the
Jackrabbit zone fails after already deploying a part of the
components.

> > Basically I believe Maven should resolve "SNAPSHOT" to the latest
> > build in the repository and internally still use "SNAPSHOT" as the
> > version, but I might be mistaken. Perhaps we should replace the
> > ${version} variables with actual "1.4-SNAPSHOT" version labels in the
> > dependencyManagement part of the parent POM. I'll look into that.
>
> That should actually solve the problem. The problem here is that you have to
> update the parent pom on each release.

That's a small price to pay, as I've in any case used "perl -i -pe
s/x.y-SNAPSHOT/.../" to do the version updates.

BR,

Jukka Zitting

Re: Using snapshot builds with maven guide

Posted by Christoph Kiehl <ch...@sulu3000.de>.
Jukka Zitting wrote:

> The build number that replaces the "SNAPSHOT" part is essentially a
> timestamp and a sequence number. Since the different components are
> built and deployed separately, they receive different timestamps and
> sequence numbers.

Actually it seems like the timestamp is the same for every artifact in the build 
cycle, but the sequence number differs. I think the sequence numbers should be 
the same as well. I don't know why they differ. Maybe one of the subprojects was 
added later?

> Basically I believe Maven should resolve "SNAPSHOT" to the latest
> build in the repository and internally still use "SNAPSHOT" as the
> version, but I might be mistaken. Perhaps we should replace the
> ${version} variables with actual "1.4-SNAPSHOT" version labels in the
> dependencyManagement part of the parent POM. I'll look into that.

That should actually solve the problem. The problem here is that you have to 
update the parent pom on each release.

Cheers,
Christoph


Re: Using snapshot builds with maven guide

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 4/18/07, Christoph Kiehl <ch...@sulu3000.de> wrote:
> Jukka Zitting wrote:
> > The dependency versions are defined in the jackrabbit parent POM using
> > the Maven dependencyManagement feature. I believe Maven should
> > automatically download also the parent POM and take the version
> > numbers from there.
>
> That's right, and maven does it exactly like that. The problem is, that if you
> take for example the latest snapshot POM
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/jackrabbit/jackrabbit/1.3-SNAPSHOT/jackrabbit-1.3-20070418.104105-138.pom
> the version number of all jackrabbit dependencies is 1.3-20070418.104105-138.
> But there is no jackrabbit-core with version number 1.3-20070418.104105-138. The
> jackrabbit-core with that timestamp got a different build number.

The build number that replaces the "SNAPSHOT" part is essentially a
timestamp and a sequence number. Since the different components are
built and deployed separately, they receive different timestamps and
sequence numbers.

Basically I believe Maven should resolve "SNAPSHOT" to the latest
build in the repository and internally still use "SNAPSHOT" as the
version, but I might be mistaken. Perhaps we should replace the
${version} variables with actual "1.4-SNAPSHOT" version labels in the
dependencyManagement part of the parent POM. I'll look into that.

BR,

Jukka Zitting

Re: Using snapshot builds with maven guide

Posted by Christoph Kiehl <ch...@sulu3000.de>.
Jukka Zitting wrote:
> Hi,
> 
> On 4/18/07, Christoph Kiehl <ch...@sulu3000.de> wrote:
>> I recently tried using the jackrabbit snapshot build from
>> http://people.apache.org/repo/m2-snapshot-repository/org/apache/jackrabbit/. 
>> One
>> problem I discovered is that in the POM for jackrabbit-core for 
>> example there
>> are no versions for jackrabbit dependencies like jackrabbit-api defined.
> 
> The dependency versions are defined in the jackrabbit parent POM using
> the Maven dependencyManagement feature. I believe Maven should
> automatically download also the parent POM and take the version
> numbers from there.

That's right, and maven does it exactly like that. The problem is, that if you 
take for example the latest snapshot POM 
http://people.apache.org/repo/m2-snapshot-repository/org/apache/jackrabbit/jackrabbit/1.3-SNAPSHOT/jackrabbit-1.3-20070418.104105-138.pom 
the version number of all jackrabbit dependencies is 1.3-20070418.104105-138. 
But there is no jackrabbit-core with version number 1.3-20070418.104105-138. The 
jackrabbit-core with that timestamp got a different build number. I don't really 
  know why, and it should be correctable, but unfortunately right now I've got 
no time to dig into that.

Cheers,
Christoph


Re: Using snapshot builds with maven guide

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 4/18/07, Christoph Kiehl <ch...@sulu3000.de> wrote:
> I recently tried using the jackrabbit snapshot build from
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/jackrabbit/. One
> problem I discovered is that in the POM for jackrabbit-core for example there
> are no versions for jackrabbit dependencies like jackrabbit-api defined.

The dependency versions are defined in the jackrabbit parent POM using
the Maven dependencyManagement feature. I believe Maven should
automatically download also the parent POM and take the version
numbers from there.

BR,

Jukka Zitting