0

I'm using <finalName> in build section of maven to rename my-artifact-<project.version>-SNAPSHOT.jar to my-artifact.jar, I see that the resulting artifact is renamed as expected in my target folder but when the same artifact is specified as a dependency in a different module, it downloads it as my-artifact-<project.version>-SNAPSHOT.jar in this modules target WEB-INF/lib/. Is there a way to get the renamed version to be downloaded as dependency?

I don't need the version number attached as I'm running maven build in a dockerized build environment.

A.R.K.S
  • 1,692
  • 5
  • 18
  • 40

1 Answers1

2

I assume you are building a war.

Then you can specify the file name of libraries inside the war with outputFileNameMapping:

http://maven.apache.org/plugins/maven-war-plugin/examples/file-name-mapping.html

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • I'm mostly building jars which I need to be downloaded as dependencies without version suffix. Is there a way to achieve this? 'finalName' does not seem to do this.. I dont see anything similar to `outputFileNameMapping ` in maven-jar-plugin – A.R.K.S Feb 24 '20 at 03:45
  • The thing is that you cannot influence how they will be downloaded, but you can set their name inside a WAR or EAR. – J Fabian Meier Feb 24 '20 at 06:15
  • Is there way to apply this mapping on certain jars inside a war ? I want to apply this format in in-house dependencies and not all 3rd party dependencies. – A.R.K.S Feb 24 '20 at 06:21
  • I think i can use a regex in place of artifact id to do this. Will try it out. Thank you! – A.R.K.S Feb 24 '20 at 06:30