How to build maven project without version
If you wanted to build maven project without the version details mentioned in your pom file, then you need to follow the below instructions.
Let’s say you have the pom.xml with following details
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.sneppets</groupId> <artifactId>MyService</artifactId> <version>2.0.0</version> <name>MyService</name> ---- ---- <build> ---- <finalName>${project.artifactId}-${project.version}</finalName> ---- <build> ---- ---- </project>
You could see finalName within build tags of your pom file. By default, the finalName is ${artifactId}-${version} and this is the name of the bundled project once it is finally built (jar or war or ear).
Build Maven Project without version detail
For instance, if the bundled project has jar extension, then the final name of the built target file looks like MyService-2.0.0.jar and if you wanted to build the maven project without version in the final name, then you can change the name through <finalName> element as below
<finalName>${project.artifactId}</finalName>
With the above changes, the final name of the file now looks like MyService.jar without version details. That’s it.
Further Learning
- How to manually install JAR dependency in local repository using maven
- Find an element in a list using Java 8 Stream API
- How to check docker image contents after you pull a docker image
- JSONException : A JSONObject text must begin with ‘{‘ at 1 [character 2 line 1]