我正在部署一个多模块项目,将多个wars部署到Tomcat服务器上,它几乎可以正常工作。这是我的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>这段代码将一个admin.war和一个frontend.war部署到Tomcat服务器。但是我想重命名这些war文件,而不重命名Maven模块。
我用谷歌搜索了几个小时,没有任何结果。你能给我点帮助吗?
谢谢!
发布于 2015-02-14 00:23:56
我不确定它是否有效,但您可以尝试使用<finalName>标记。
如果你使用下面的代码,它会创建一个"myFinalFile.jar“而不是”group +工件id“。
<build>
<finalName>MyFinalFile</finalName>
</build>因此,我建议您测试以下pom.xml。在<webapp>部分中添加了<finalName>标记:
<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>https://stackoverflow.com/questions/28503205
复制相似问题