1

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.

6cef
  • 642
  • 6
  • 15

1 Answers1

0

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.

M Sach
  • 30,322
  • 72
  • 198
  • 300
  • is there a way to format the "-1.0" part of your filename as "##20130920110753"? – 6cef Sep 20 '13 at 15:08
  • that's the date and time i ran it. that way tomcat 7 will always pick up that war as the newest version (because of the way it does string comparisons.) – 6cef Sep 20 '13 at 15:09
  • see http://stackoverflow.com/questions/1224359/how-do-i-add-time-stamp-information-to-maven-artifacts – M Sach Sep 20 '13 at 15:16