繁体   English   中英

使用tomcat7-maven-plugin设置已部署战争的名称

[英]Set the name of deployed war with tomcat7-maven-plugin

我正在将一个多模块项目部署到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.warfrontend.war部署到Tomcat服务器。 但是我想重命名那些war文件,而不重命名Maven模块。

我正在搜索它几个小时,没有任何结果。 你能帮我什么忙吗?

谢谢!

我不确定它是否有效,但是您可以尝试使用<finalName>标记。

如果使用以下示例,它将创建一个“ myFinalFile.jar”而不是“ group +工件” ID。

<build>
    <finalName>MyFinalFile</finalName>
</build>

因此,我建议您测试以下pom.xml。 <finalName> <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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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