SNAPSHOT is saying you depend on the 'cutting edge' build. Working with snapshots of everything for releases is frowned upon as it means your builds aren't actually repeatable; however its useful during development.

maven jar:install-snapshot

builds a jar with a timestamp instead of the usual version number. It installs both this, and a copy with the word 'SNAPSHOT' in place of the version number into your local repository. The use of the timestamp will become clear shortly...

Now you can declare a dependency on that jar with 'SNAPSHOT' as its version. Maven will always try to download the latest SNAPSHOT version from a remote repository, but it will only use it if it's newer than your local copy.

Once you're ready to do a release, you want to make your build repeatable. The 'release' plugin is supposed to let you flip all your dependencies from snapshots to specific versions. It does this by looking at a snapshot-version file and changing your dependency to the matching timestamped jar - which is why we have the second copy of the jar.

Currently maven only updates what the snapshot jar is when you do a snapshot build. Personally I think it would make more sense to update it for all builds, since at present the release build can /never/ be the snapshot. Herein lies the problem you found with log4j; you can't just declare all your dependencies as snapshots, then make them release dependencies again, because many jars have never had a snapshot release. Log4j is a case in point - you might think the snapshot would be 1.2.8 but there has never been a /timestamped/ snapshot build, so snapshot dependencies on log4j will not work.

Cheers,
        Baz
Maximilian A. Ott wrote:

Thanks for the reply, but this is not the problem. I see your point, but
Apache is simply ignoring the redundant slash.

I saw it check for the library once (when it wasn't installed) and
printed a message to that effect. Now it is not even trying to do that.

Ahhh! Lights flashing!

If there is a dependency Maven downloads it into it's LOCAL repository
and not, as I expected, into the project's target directory. I assume
Maven is building a classpath for compiling to point back into the local
repository. Unexpected, but it does make sense.

I also realized that I was setting up the wrong dependency (I needed
log4j, not jdom).


Now it works!

What I still haven't figured out is the "SNAPSHOT" keyword. I started
with:

    <dependency>
      <id>log4j</id>
      <version>SNAPSHOT</version>
    </dependency>

But that failed with an error. I know the documentation said that it
will consider this a failed dependency, but it's not clear how it is
supposed to work. The following did, but locks me into a particular
version.

    <dependency>
      <id>log4j</id>
      <version>1.2.7</version>
    </dependency>

Thanks,

-max



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to