0

maven is building a war, and it is uploading the war to nexus. i want to have the uploaded war not have the version number in the name. is there a maven config that will strip off, or just not include, the version number in the name?

bmw0128
  • 13,470
  • 24
  • 68
  • 116
  • The artifact created by the default install phase always end up with `/groupId/artifactId/version/artifactId-version.war` in local repo (by mvn install) and/or remote repo (by mvn deploy). You can use assembly plugin distribute extra `artifactId-version-classifier.*` files but AFAIK, version is a fundamental in the artifact name, you shouldn't strip the version part even if there is a way to do so, it against the convention. – yorkw Dec 10 '12 at 20:25
  • Maybe you don't need Nexus (or any Maven repo) to do that ? – Guillaume Husta Dec 11 '12 at 00:17

2 Answers2

1

Nexus is a versioned data store. Each Maven module is uniquely identified by a GAV coordinate:

  • G roupId
  • A rtifact
  • V ersion

So you cannot omit version from a Maven artifact's name.

Question back would be. Why do you want to do this?

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • 1
    Suppose i use Nexus as provider of artifacts in a deployment pipeline. Then I want to use war name as, for example, someservice.war to get it deployed in /someservice in the application service. So i dont want to add version number on the generated war file. Is there any ways to achieve this? Well, yes, in the pipeline it could be added an additional step to take care of it, but having the final, required war names, matching its target context would be simpler, imho. – juancancela Apr 22 '13 at 17:31
  • 1
    You can easily to this, by downloading the latest revision of the artifact and save it to a local file without a revision number (for example: curl $URL > someservice.war). The following answer explains how to download the most recent revision: http://stackoverflow.com/questions/7911620/using-the-nexus-rest-api-to-get-latest-artifact-version-for-given-groupid-artfic/7922863#7922863 – Mark O'Connor Apr 22 '13 at 18:46
0

As mentioned already, you cannot omit the version. However, if you are looking to deploy the artifact so that the final war name matches the target context you can name the war war-name##0.1.war.

When you deploy a war like this under tomcat for example, the target context is /war-name however the version is still displayed under tomcat manager. Very useful to see at a glance what version is deployed and yet have a consistent target context between each deployment.

ls91
  • 11
  • 2