Home > Java > javaTutorial > body text

How to Customize the Final Name of a Maven JAR Artifact?

DDD
Release: 2024-11-10 07:24:02
Original
985 people have browsed it

How to Customize the Final Name of a Maven JAR Artifact?

Controlling Maven's JAR Artifact Final Name

The final name of a JAR artifact can be customized in Maven to fit specific project requirements.

When defining a property in a super POM to be used by child projects for the destination of the generated artifact, the project/build/finalName property can be leveraged. However, its usage may differ slightly depending on the Maven version being used.

Maven 3 and Later

In Maven 3 and later, setting the finalName property directly in the build section of the POM is sufficient to control the artifact's final name:

<packaging>jar</packaging>
<build>
  <finalName>MyCustomName</finalName>
</build>
Copy after login

Older Maven Versions

For older Maven versions, finalName must be set in the configuration section of the Maven JAR plugin:

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

By specifying the finalName property, the generated artifact will have the customized name, allowing for better organization and control over the generated JAR artifacts.

The above is the detailed content of How to Customize the Final Name of a Maven JAR Artifact?. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!