Ah okay, I see what you're getting at.
I changed the packing type of the project to 'pom' and tried a 'mvn
deploy'. As expected both the pom file and jar artifact (including
classifier) were updated to my Repository with the unique identifiers.
Looks like this solves my problem.
I'm glad I can avoid creating two jars from a single project, that
didn't feel right.
Thanks for all your help, Marshall.
On 5/4/2010 4:36 PM, Marshall Schor wrote:
On 5/4/2010 3:31 PM, Michael Delaney wrote:
I tried this and the deployed jars still lacks the unique time stamp
identifier.
Sorry, I guessed wrong. To fix, change the name in the<id> to
something other than "default-jar", such as "my very own jar".
Then it works (it did for me), except, that you'll get an "extra"
artifact, the "main" one, which is a jar without a classifier.
(To get rid of this extra jar, you could change the packaging type from
jar to pom. This says that the main output of the project is the "POM"
artifact, and the rest of the outputs are "attachments" to that.)
Maven always wants to have 1 main artifact per project; the rest of the
things are called attachments. The exception is the POM, which is
always carried along, and isn't normally considered the main output
artifact (except for packaging type=pom).
See
http://www.sonatype.com/people/2010/01/how-to-create-two-jars-from-one-project-and-why-you-shouldnt/
for a discussion of this.
-Marshall
On 5/4/2010 2:39 PM, Marshall Schor wrote:
Well, I was able to reproduce your problem, and then found a work-around
for it...
Here's the work-around:
Change your POM from:
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<classifier>config</classifier>
</configuration>
</plugin>
to
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>default-jar</id> <!-- special name for
normal jar build -->
<goals><goal>jar</goal></goals>
<configuration>
<classifier>config</classifier>
</configuration>
</execution>
</executions>
</plugin>
If you don't put in the<id>...</id> with that name, you get 2 jars
built - one by default without the classifier, plus the classifier.
I don't know why this works, and the other one doesn't work. Maybe
someone else can say...
-Marshall
On 5/4/2010 8:30 AM, Michael Delaney wrote:
Sure. Please see the attached pom file.
I do have a parent defined but it's there just to define release
profiles as well as version information. No additional configuration
(for the maven-jar-plugin) is in the parent pom.
On 5/3/2010 7:53 PM, Marshall Schor wrote:
it looks like your jar file has no classifier. A plain jar file is
being uploaded. Can you post the part of the POM where you are
defining
the classifier artifact, and attaching it?
-Marshall
On 5/3/2010 7:09 PM, Michael Delaney wrote:
All,
I have a simple maven project that generates a jar file; with the
classifier 'config'. When I call the 'deploy' phase, the pom file is
uploaded with unique identifier (as expected) but the jar file is not
(see examples below); the maven metadata is updated with the
timestamp
as well. When I put a dependency on the jar file, Maven can not
resolve the artifact because it's looking for the jar file with the
timestamp (as denoted by the maven-metadata file).
Has anyone else seen this issue? I'm using Maven 2.2.1 on Solaris.
[Example]
-rw-r--r-- 1 archiva archiva 382 May 3 18:47
maven-metadata.xml
-rw-r--r-- 1 archiva archiva 52 May 3 18:47
maven-metadata.xml.md5
-rw-r--r-- 1 archiva archiva 60 May 3 18:47
maven-metadata.xml.sha1
-rw-r--r-- 1 archiva archiva 1106 May 3 18:45
myApplication-1.0.0-20100503.224504-1.pom
-rw-r--r-- 1 archiva archiva 32 May 3 18:45
myApplication-1.0.0-20100503.224504-1.pom.md5
-rw-r--r-- 1 archiva archiva 40 May 3 18:45
myApplication-1.0.0-20100503.224504-1.pom.sha1
-rw-r--r-- 1 archiva archiva 1106 May 3 18:45
myApplication-1.0.0-20100503.224537-2.pom
-rw-r--r-- 1 archiva archiva 32 May 3 18:45
myApplication-1.0.0-20100503.224537-2.pom.md5
-rw-r--r-- 1 archiva archiva 40 May 3 18:45
myApplication-1.0.0-20100503.224537-2.pom.sha1
-rw-r--r-- 1 archiva archiva 4080 May 3 18:47
myApplication-1.0.0-20100503.224708-3.jar
-rw-r--r-- 1 archiva archiva 32 May 3 18:47
myApplication-1.0.0-20100503.224708-3.jar.md5
-rw-r--r-- 1 archiva archiva 40 May 3 18:47
myApplication-1.0.0-20100503.224708-3.jar.sha1
-rw-r--r-- 1 archiva archiva 757 May 3 18:47
myApplication-1.0.0-20100503.224708-3.pom
-rw-r--r-- 1 archiva archiva 32 May 3 18:47
myApplication-1.0.0-20100503.224708-3.pom.md5
-rw-r--r-- 1 archiva archiva 40 May 3 18:47
myApplication-1.0.0-20100503.224708-3.pom.sha1
-rw-r--r-- 1 archiva archiva 4157 May 3 18:45
myApplication-1.0.0-SNAPSHOT-config.jar
-rw-r--r-- 1 archiva archiva 32 May 3 18:45
myApplication-1.0.0-SNAPSHOT-config.jar.md5
-rw-r--r-- 1 archiva archiva 40 May 3 18:45
myApplication-1.0.0-SNAPSHOT-config.jar.sha1
[maven-metadata.xml]
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.mycompany</groupId>
<artifactId>myApplication</artifactId>
<version>1.0.0-SNAPSHOT</version>
<versioning>
<snapshot>
<buildNumber>3</buildNumber>
<timestamp>20100503.224708</timestamp>
</snapshot>
<lastUpdated>20100503224708</lastUpdated>
</versioning>
</metadata>
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]