Reputation: 1918
I'm deploying a multi-module project, with multiple wars to a Tomcat server, and it works almost fine. Here's the part of my pom.xml
:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>${ed.tomcat.server.name}</server>
<webapps>
<webapp>
<groupId>com-mycompany.project</groupId>
<artifactId>admin</artifactId>
<version>${ed.project.version}</version>
<type>war</type>
<asWebapp>true</asWebapp>
<path>/ed-admin</path>
</webapp>
<webapp>
<groupId>com.mycompany.project</groupId>
<artifactId>frontend</artifactId>
<version>${ed.project.version}</version>
<type>war</type>
<asWebapp>true</asWebapp>
<path>/ed-frontend</path>
</webapp>
</webapps>
</configuration>
</plugin>
This code deploys an admin.war
and a frontend.war
to the Tomcat server, fine. But I'd like to rename those war files, without renaming the Maven module.
I'm googling it for hours, without any results. Can you give me any help?
Thanks!
Upvotes: 2
Views: 2791
Reputation: 668
I'm not sure if it works but you can try to use the <finalName>
tag.
If you using e.g. the following it would create an "myFinalFile.jar instead of the group + artifact id.
<build>
<finalName>MyFinalFile</finalName>
</build>
So i would recommend you to test the following pom.xml. the <finalName>
tag was added within the <webapp>
section:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>${ed.tomcat.server.name}</server>
<webapps>
<webapp>
<groupId>com-mycompany.project</groupId>
<artifactId>admin</artifactId>
<version>${ed.project.version}</version>
<type>war</type>
<asWebapp>true</asWebapp>
// following line must be configured to your needs
<finalName>myAdminFileName</finalName>
<path>/ed-admin</path>
</webapp>
<webapp>
<groupId>com.mycompany.project</groupId>
<artifactId>frontend</artifactId>
<version>${ed.project.version}</version>
<type>war</type>
<asWebapp>true</asWebapp>
// following line must be configured to your needs
<finalName>myFrontendFileName</finalName>
<path>/ed-frontend</path>
</webapp>
</webapps>
</configuration>
</plugin>
Upvotes: 1