Maven: How to create assembly with snapshot artifacts without timestamps file name?
Asked Answered
E

2

16

I've a repository containing snapshot artifacts with timestamps.

I want to create an assembly, that contains the dependencies. This works fine. But the artifact names contains the timestamp. So i wonder how to remove the timestamp from filename for the assembly only.

I've used this dependencySet:

<outputFileNameMapping>${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>

But version seams to contain already the timestamp. So is there any chance to get a 1.1.1-SNAPSHOT instead of 1.1.1-20100323.071348-182?

I'm using version 2.2-beta-4 of maven-assembly-plugin.

Endogenous answered 25/3, 2010 at 15:28 Comment(4)
What versions of maven and of the assembly plugin are you using?Gadgetry
I'm using version 2.2-beta-4 of maven-assembly-plugin. (I've added this information to my question)Endogenous
The accepted answer works perfectly well with Maven 3 and version 2.2.1 of the assembly plugin.Idonna
I also have same requirement, can you please share which file I need to add this tag into? This file is added apart from pom.xml?Dewclaw
G
25

Could you try the following for the outputFileNameMapping:

${artifactId}-${baseVersion}.${extension}

According to issues like MASSEMBLY-67, MASSEMBLY-91:

Using ${baseVersion} for cases where you want to preserve the -SNAPSHOT naming, the plugin retains the ability to use ${version} for the timestamp-buildnumber naming, which is useful for describing the exact library version included in the assembly.

Update: After feedback from the OP, the exact syntax is (wasn't totally sure of this):

${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}
Gadgetry answered 25/3, 2010 at 20:10 Comment(3)
Thanks a lot. Just a little change and it works fine: <outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}</outputFileNameMapping>Endogenous
@Endogenous You're welcome. Glad it works. I wasn't totally sure for the syntax of properties but I thought you would figure it out :)Gadgetry
You may also add the classifier: ${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}Sherikasherill
B
2

I faced a similar issue when trying to build a bundle with the assembly plugin which contained a folder with the version number (I'm packaging WSDLs and XSDs).

The workaround I found is quite simple, I put the actual version number in a property (e.g. 1.0), which makes it available in the bundle.xml file for the assembly plugin, and set the pom version's to:

<version>${service.version}-SNAPSHOT</version>

This way the content of my package isn't influenced by the SNAPSHOT marker, in particular it isn't modified when doing the release.

Bufordbug answered 9/12, 2011 at 11:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.