You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Maximilian A. Ott" <ma...@semandex.net> on 2003/07/04 21:09:04 UTC
Problems with dependencies
I downloaded Maven a week ago and have a really hard time getting any of
my projects converted. First of all, I can't find any documentation
which gives a high-level overview on how it is supposed to work (even
finding any useful information on the web site was a bit of a challenge
- now that I did find it seems obvious but not going in).
Anyhow, my problem is that all my projects depend on external libraries.
I cut one down to only depend on one library (jdom.jar). I added the
following to my project.xml file:
<dependencies>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>b8</version>
<url>http://www.jdom.org/</url>
</dependency>
</dependencies>
I also added the following to my project.properties file:
maven.repo.remote=http://sxserver.semandex.net/maven/
When I start maven with:
C:\src\my\SxUtil-2>maven dist:build
__ __
| \/ |__ Jakarta _ ___
| |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
|_| |_\__,_|\_/\___|_||_| v. 1.0-beta-9-SNAPSHOT
dist:build-setup:
[mkdir] Created dir: C:\src\my\SxUtil-2\target\distributions
xdoc:init:
[mkdir] Created dir: C:\src\my\SxUtil-2\target\generated-xdocs
[mkdir] Created dir: C:\src\my\SxUtil-2\target\docs
java:prepare-filesystem:
[mkdir] Created dir: C:\src\my\SxUtil-2\target\classes
java:compile:
......
--------------
It does NOT download the jdom jar file.
(http://sxserver.semandex.net/maven/jdom/jars/jdom-b8.jar does return
the jar).
I saw an attempt for downloading once (before I had the jar in place)
As Maven seems to be able to replace a lot of my ad-hoc project
management setups I would love to get it going and put it through its
paces, but learning the first few steps is always the biggest challenge.
Any help would be greatly appreciated.
-max
Re: Problems with dependencies
Posted by Brian Ewins <Br...@btinternet.com>.
dion@multitask.com.au wrote:
> Brian Ewins <Br...@btinternet.com> wrote on 08/07/2003 09:30:28 PM:
>
>
>>Maximilian A. Ott wrote:
>>
>>>on the bleeding edge, but is there a way to declare the "latest on
>
> that
>
>>>development branch", or in other words the "1.2.x" where "x" denotes
>
> the
>
>>>latest revision of the 1.2 series.
>>Yes and no. You can declare a dependency on version "1.2-SNAPSHOT", but
>>you can't build something that looks like that!
>>
>>Ok, you can sortof, via ugly hacks.
>>
>>Ugly hack #1: put part of the version number in the artifact name. ie
>>artifactid = foo-1.2, install-snapshot will now produce
>>'foo-1.2-20030708.094617.jar' (or something like that). Not quite what
>>you wanted.
>
> ???
>
> jar:install-snapshot creates a -SNAPSHOT jar in the local repo.
>
> What's wrong with that?
Not a huge amount. I called it an ugly hack because it moves version
information out of the version id and into the artifact id...you can't
be 100% comfortable with that[1]? I said it wasnt quite what Max wanted
because the version number isn't quite what he asked for, as its not of
the form 1.2.x . Trivial I know; but thats why I mentioned
foo-1.2-20030708.094617.jar, I didn't mean to imply that
foo-1.2-SNAPSHOT.jar wouldn't be built as well.
-Baz
[1] And you can't simultaneously say 'I want the latest foo', 'I want
the latest foo version 1', 'I want the latest foo version 1.2' with this
hack... the others do offer this option.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Problems with dependencies
Posted by di...@multitask.com.au.
Brian Ewins <Br...@btinternet.com> wrote on 08/07/2003 09:30:28 PM:
> Maximilian A. Ott wrote:
>
> > Thanks that was very instructive. I understand that SNAPSHOT is the
one
> > on the bleeding edge, but is there a way to declare the "latest on
that
> > development branch", or in other words the "1.2.x" where "x" denotes
the
> > latest revision of the 1.2 series.
> >
> > We are following the convention of major.minor.revision numbering and
it
> > would be great if I don't have to change all the project files if we
> > release a new revision of a library (which shouldn't change the
> > semantics of the interface).
> >
> > Can I do this already?
>
>
> Yes and no. You can declare a dependency on version "1.2-SNAPSHOT", but
> you can't build something that looks like that!
>
> Ok, you can sortof, via ugly hacks.
>
> Ugly hack #1: put part of the version number in the artifact name. ie
> artifactid = foo-1.2, install-snapshot will now produce
> 'foo-1.2-20030708.094617.jar' (or something like that). Not quite what
> you wanted.
???
jar:install-snapshot creates a -SNAPSHOT jar in the local repo.
What's wrong with that?
--
dIon Gillard, Multitask Consulting
Blog: http://blogs.codehaus.org/people/dion/
Work: http://www.multitask.com.au
Re: Problems with dependencies
Posted by Brian Ewins <Br...@btinternet.com>.
Maximilian A. Ott wrote:
> Thanks that was very instructive. I understand that SNAPSHOT is the one
> on the bleeding edge, but is there a way to declare the "latest on that
> development branch", or in other words the "1.2.x" where "x" denotes the
> latest revision of the 1.2 series.
>
> We are following the convention of major.minor.revision numbering and it
> would be great if I don't have to change all the project files if we
> release a new revision of a library (which shouldn't change the
> semantics of the interface).
>
> Can I do this already?
Yes and no. You can declare a dependency on version "1.2-SNAPSHOT", but
you can't build something that looks like that!
Ok, you can sortof, via ugly hacks.
Ugly hack #1: put part of the version number in the artifact name. ie
artifactid = foo-1.2, install-snapshot will now produce
'foo-1.2-20030708.094617.jar' (or something like that). Not quite what
you wanted.
Ugly hack #2: locally we use a repository webapp as our 'remote repo'.
This lets us resolve requests for 'foo-SNAPSHOT.jar', or
'foo-1.2-SNAPSHOT.jar' as if it matched files to the regexp
/foo-1\.2.*\.jar/ and returned the most recent file. I've posted the
webapp to the list before. It doesn't play well with the 'release'
plugin though, which makes going through releases a pain.
Ugly hack #3: get your jelly on. Write a goal in your maven.xml to
create the missing jars in your repo. It should do something like: build
the normal jar first, then for each period in your version, create a
SNAPSHOT jar in your local repo with that prefix. e.g. build
foo-1.2.3.jar, then install foo-1-SNAPSHOT.jar, foo-1.2-SNAPSHOT.jar,
foo-1.2.3-SNAPSHOT.jar. (with these names, not the timestamps). This
just fakes up what the repo webapp does, but you can make it work
without a repo server. Again, the release plugin won't play well with this.
This kind of stuff has been discussed to death on the mailing lists,
there are no great answers, because by design the remote repo is usually
'dumb' - which allows you to use any server, ftp, file, http, scp... to
serve the files up. The various differences and weaknesses in the
protocols conspire to make it hard to maintain decent versioning
information.
-Baz
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Problems with dependencies
Posted by "Maximilian A. Ott" <ma...@winlab.rutgers.edu>.
Thanks that was very instructive. I understand that SNAPSHOT is the one
on the bleeding edge, but is there a way to declare the "latest on that
development branch", or in other words the "1.2.x" where "x" denotes the
latest revision of the 1.2 series.
We are following the convention of major.minor.revision numbering and it
would be great if I don't have to change all the project files if we
release a new revision of a library (which shouldn't change the
semantics of the interface).
Can I do this already?
Thanks,
-max
> -----Original Message-----
> From: Brian Ewins [mailto:Brian.Ewins@btinternet.com]
> Sent: Monday, July 07, 2003 12:23 PM
> To: Maven Users List
> Subject: Re: Problems with dependencies
>
>
> 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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Problems with dependencies
Posted by Brian Ewins <Br...@btinternet.com>.
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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Problems with dependencies
Posted by "Maximilian A. Ott" <ma...@winlab.rutgers.edu>.
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Problems with dependencies
Posted by Brian Ewins <Br...@btinternet.com>.
I can't see any other replies to this so...
You appear to have an extra '/' at the end of maven.repo.remote. Try:
maven.repo.remote=http://sxserver.semandex.net/maven
If you looked in the logs of your webserver, you'd find it would be
reporting errors for
http://sxserver.semandex.net/maven//jdom/jars/jdom-b8.jar
(note the double slash in the middle). Of course the problem could be
that you simply don't have the jdom jar sitting there?
Sometimes running with 'maven -X' throws out a lot more useful debug
information.
Hope this helped,
Baz
Maximilian A. Ott wrote:
> I downloaded Maven a week ago and have a really hard time getting any of
> my projects converted. First of all, I can't find any documentation
> which gives a high-level overview on how it is supposed to work (even
> finding any useful information on the web site was a bit of a challenge
> - now that I did find it seems obvious but not going in).
>
> Anyhow, my problem is that all my projects depend on external libraries.
> I cut one down to only depend on one library (jdom.jar). I added the
> following to my project.xml file:
>
> <dependencies>
> <dependency>
> <groupId>jdom</groupId>
> <artifactId>jdom</artifactId>
> <version>b8</version>
> <url>http://www.jdom.org/</url>
> </dependency>
> </dependencies>
>
> I also added the following to my project.properties file:
>
> maven.repo.remote=http://sxserver.semandex.net/maven/
>
> When I start maven with:
>
> C:\src\my\SxUtil-2>maven dist:build
> __ __
> | \/ |__ Jakarta _ ___
> | |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
> |_| |_\__,_|\_/\___|_||_| v. 1.0-beta-9-SNAPSHOT
>
>
> dist:build-setup:
> [mkdir] Created dir: C:\src\my\SxUtil-2\target\distributions
>
> xdoc:init:
> [mkdir] Created dir: C:\src\my\SxUtil-2\target\generated-xdocs
> [mkdir] Created dir: C:\src\my\SxUtil-2\target\docs
>
> java:prepare-filesystem:
> [mkdir] Created dir: C:\src\my\SxUtil-2\target\classes
>
> java:compile:
> ......
>
> --------------
>
> It does NOT download the jdom jar file.
> (http://sxserver.semandex.net/maven/jdom/jars/jdom-b8.jar does return
> the jar).
>
> I saw an attempt for downloading once (before I had the jar in place)
>
> As Maven seems to be able to replace a lot of my ad-hoc project
> management setups I would love to get it going and put it through its
> paces, but learning the first few steps is always the biggest challenge.
>
> Any help would be greatly appreciated.
>
> -max
>
>
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0"?>
> <project>
> <pomVersion>1</pomVersion>
> <name>sx.util</name>
> <id>sx.util</id>
> <currentVersion>1.1.3</currentVersion>
> <organization>
> <name>Wairoa River Lab</name>
> <url>http://www.sxmx.org/</url>
> </organization>
> <inceptionYear>2003</inceptionYear>
> <package>org.wairoa</package>
>
> <shortDescription>Useful Tools</shortDescription>
>
> <description>
> This is a collection of useful classes ...
> </description>
>
> <repository>
> <connection>
> scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven
> </connection>
> <url>
> http://cvs.semandex.net/viewcvs/sx-util/
> </url>
> </repository>
>
> <versions>
> <version>
> <id>1.1.3</id>
> <name>1.1.3</name>
> <tag>HEAD</tag>
> </version>
> </versions>
>
> <developers>
> <developer>
> <name>Maximilian A. Ott</name>
> <id>max</id>
> <email>max@ott.name</email>
> <organization></organization>
> </developer>
> </developers>
>
> <dependencies>
> <dependency>
> <groupId>jdom</groupId>
> <artifactId>jdom</artifactId>
> <version>b8</version>
> <url>http://www.jdom.org/</url>
> </dependency>
> </dependencies>
>
> <build>
> <nagEmailAddress>
> max@ott.name
> </nagEmailAddress>
>
> <sourceDirectory>src/java</sourceDirectory>
>
> <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
> <integrationUnitTestSourceDirectory/>
>
> <aspectSourceDirectory/>
>
> <jars>
> </jars>
> </build>
> </project>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org