Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing version number from file name with Maven

I have a project with 5 modules in maven. Right now, when I do a "mvn clean install", it generates an ear containing the two jars, one war and one sar from the other modules.

All the file names contain the version, e.g., projectx-ear-2.0.0.ear, projectx-client-2.0.0.jar, etc.

I need to rename one of the jars and the final ear to omit the version in the file name. It should look like this:

projectx-ear.ear | +-- projectx-client.jar | +-- projectx-misc-2.0.0.jar | +-- projectx-sar-2.0.0.sar | \-- projectx-web-2.0.0.web 

Right now I'm using the following plugins to build: maven-compiler-plugin and maven-release-plugin

What would be the best way to achieve the results I expect?

like image 969
Bani Avatar asked Feb 08 '10 21:02

Bani


People also ask

What happens if you don't specify a version in Maven?

Maven won't allow any other either. Build will fail if version is not found.

What happens if you don't specify version in POM XML?

of your question: If you don't specify a version there are various different outcomes: a) you will get an error... b) if you have defined the version in the dependency management of the project's parent's pom, then that version is taken. The parent of the project doesn't have to be an enclosing superproject.

What is Maven pluginManagement?

From Maven documentation: pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.


1 Answers

You can achieve this by specifying the finalName property in your pom like this:

<build>     <finalName>${project.artifactId}</finalName> </build> 
like image 155
Péter Török Avatar answered Oct 12 '22 23:10

Péter Török