Here's two examples:
http://svn.apache.org/repos/asf/sling/trunk/launchpad/base/pom.xml -
creates artifacts with "app" and "webapp" classifiers which are then
used as dependencies in other projects.

http://kenai.com/projects/boxspring/sources/main/content/trunk/boxspring
-core/pom.xml?rev=125 - creates a "tests" artifact (using the standard
jar:test-jar goal) and a "testclasses" artifact. The latter is simply a
packaging of the test classes. The latter is a packaging some support
classes which the test classes use. These two artifacts are used in
different contexts - sometimes the tests are extended (in which case the
"tests" artifact is used) and sometimes the test support classes are
used without the test cases (in which case the "testclasses" artifact is
used).

There's also a brief example on the jar plugin usage page:
http://maven.apache.org/plugins/maven-jar-plugin/usage.html (in the "How
to create an additional attached jar artifact from the project"
section).

I think Todd answered your second question already. One gotcha - there's
only one pom, so you can't have different dependencies per classified
artifact. This can be worked around with excludes in the downstream
project, but if you run into this repeatedly, it suggests that you
really need two projects, not two artifacts from the same project
differentiated by classifier.


Justin

-----Original Message-----
From: Quintin Beukes [mailto:[email protected]] 
Sent: Monday, October 19, 2009 2:48 PM
To: Maven Users List
Subject: Re: Config.jar project dependency

>> OK, firstly you can only produce one artifact per POM.
> This is not true. A POM has one GAV, but you can produce multiple
artifacts with different classifiers. For example, most Java projects
using the release plugin will have a source JAR file produced from the
same POM and codebase. It has the same GAV, but an alternate classifier.

That's very interesting. Could you perhaps point me in the right
direction no how this would work.

Lets say I make 2 jars with 2 separate classifiers, how to choose which
one becomes a dependency of another project?

Take Anders' case for example. Produce 2 jars "project1.jar" and
"config.jar" from the same POM. How would he then include the config.jar
as a dependency in another project?

Q

---------------------------------------------------------------------
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