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
Release: 2024-11-08 06:42:02
Original
629 people have browsed it

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>
Copy after login

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>
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template