Home > Java > javaTutorial > How to control the final name of Maven JAR artifacts?

How to control the final name of Maven JAR artifacts?

Susan Sarandon
Release: 2024-11-12 15:59:02
Original
1038 people have browsed it

How to control the final name of Maven JAR artifacts?

Controlling the Final Name of Maven JAR Artifacts

In Maven, the finalName property allows developers to specify the final name of the generated JAR artifact, which is used for both the file name and the artifact identifier in repositories.

Understanding the Issue

The provided example sets the finalName property in the section of the pom.xml. However, you may encounter issues where the modified artifact name is not reflected in the generated JAR file.

Solution

If you are using Maven 3 or later, you can set the finalName property directly in the section of the pom.xml, as demonstrated in the provided code snippet:

<build>
    <finalName>WhatEverYouLikey</finalName>
</build>
Copy after login

For older versions of Maven, you will need to configure the finalName property within the Maven Jar Plugin configuration section:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <finalName>myJar</finalName>
    </configuration>
</plugin>
Copy after login

By following these instructions, you can modify the final name of the JAR artifact to meet your specific requirements.

The above is the detailed content of How to control the final name of Maven JAR artifacts?. 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