Home > Software design >  Maven compile verson in jar or war filename
Maven compile verson in jar or war filename

Time:09-22

This is my war file name:

myproject.war

but rather it should be: myproject-1.0.0-SNAPSHOT.war

So I thought it is pretty easy. I just added this in my pom.xml :

1.0.0-SNAPSHOT

But still maven built a file called myproject.war .

What can I do to get Maven to give my a file myproject-1.0.0-SNAPSHOT.war

Thanks!

pom file

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>de.mycompany.area27</groupId>
    <artifactId>myproject</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>myproject</name>
    <description>Rest based Proxy Server</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
      :
      :

CodePudding user response:

In the pom.xml file at the top change the value of artifactId tag, this will change the name of the .war file

CodePudding user response:

In pom.xml, if there is a parent then value in <parent>...<version> tag is picked, otherwise value in <version> of artifact.

  • Related