Home >Java >javaTutorial >How to Control the Final JAR Artifact Name in Maven?

How to Control the Final JAR Artifact Name in Maven?

Linda Hamilton
Linda HamiltonOriginal
2024-11-08 06:42:02734browse

How to Control the Final JAR Artifact Name in Maven?

Controlling Maven Final JAR Artifact Name

Question:

Modify a super POM's property to apply the final name of the generated artifact to all child projects. However, the project/build/finalName property doesn't seem to work.

Answer:

For Maven >= 3:

<packaging>jar</packaging>
<build>
   <finalName>WhatEverYouLikey</finalName>
</build>

See bug report/documentation for further details.

For Older Maven Versions:

Configure the finalName property within the plugin configuration section:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <finalName>myJar</finalName>                   
    </configuration>
</plugin>

The above is the detailed content of How to Control the Final JAR Artifact Name in Maven?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn