简体   繁体   中英

How do I get Maven to create an appropriately named .war for use with Tomcat 7's parallel deployment feature?

How do I get Maven to create an appropriately named .war for use with Tomcat 7's parallel deployment feature?

More generally, how do I manipulate the filename of the .war mvn produces?

Tomcat 7 wants a .war named app##V001 for use with the parallel deployment feature.

Ideally, I'd want it to use the date for the version number, rather than having to rely on a hardcoded version number anywhere.

Pom.xml to create test jar file

<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.yoursPath.core</groupId>
    <artifactId>MyFirstJarThruMaven</artifactId>
    <packaging>jar</packaging>
    <version>1.0</version>
    <name>MyFirstJarThruMaven</name>
    <url>http://maven.apache.org</url>

    <properties>
        <jdk.version>1.6</jdk.version>
    </properties>

    <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
            <source>${jdk.version}</source>
            <target>${jdk.version}</target>
        </configuration>
      </plugin>
    </plugins>
    </build>
</project>

If you run the code maven package now, Maven will package this Java project into a jar file named “MyFirstJarThruMaven-1.0.jar“, in target folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM