coolguy
coolguy

Reputation: 229

maven install file manually without version

How do I add a jar file to my local repository without appending the version number to the jar file?

Lets say I have a jar file named abc.jar and run the following command, it will create abc-1.0.jar and if I bundle this artifact in a war file, the resulting file name will be abc-1.0.jar. If I remove the -Dversion, the command fails. If I mention blank value -Dversion="", then abc-.jar is created. How do I keep the original jar's filename(abc.jar)?

mvn install:install-file -Dfile="d:\abc.jar" -DgroupId=grp1 -DartifactId=art1 -Dversion=1.0 -Dpackaging=jar

Upvotes: 3

Views: 5576

Answers (3)

user697547
user697547

Reputation: 81

This works for war packages. I haven't tried it for jars.

<build>
<!-- Ensures that the version number is not included in the packaged file name -->
<finalName>myrenamedpackage</finalName>
</build>

Upvotes: 1

J&#246;rn Horstmann
J&#246;rn Horstmann

Reputation: 34054

You can not change the name of the arifact in your maven repository, but you can configure the war plugin to use a specific nming scheme for the libs it bundles in WEB-INF/lib using the outputFileNameMapping option. To remove version information and classifiers the mapping pattern would be @{artifactId}@.@{extension}@. If the artifact id matches the original filename this should give the wanted result.

Upvotes: 0

Pascal Thivent
Pascal Thivent

Reputation: 570635

How do I add a jar file to my local repository without appending the version number to the jar file?

You can't.

Upvotes: 3

Related Questions