maven-tomcat7插件部署,始终部署到localhost:8080

xiaozhaolh 发布于 2016/11/25 17:03
阅读 1K+
收藏 0

各位大神,我公司一个环境,用maven的tomcat7插件部署代码到远程服务器,但始终不会按自己的意思部署到远程服务器而是采用了默认的部署地址。这事折腾了好几天一直没找到原因,请各位大神帮看下。如下为我环境信息,命令行执行命令,pom相关配置文件及调试日志(重点信息已用红色标注)

软件运行环境:maven 3.0.5+jdk1.7.0_25

命令行调用:D:\SPROC4GD\08_branches\sproc4gd_2.1>mvn tomcat7:redeploy -Pweb-build -Ptomcat -Dmaven.test.skip=true -Dmaven.tomcat.url=http://10.10.5.48:6006/manage
r/text -X > debuginfo.log

pom插件配置片段:

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://10.10.5.48:6006/manager/text</url>
<username>tomcat</username>
<password>****</password>
<port>6006</port>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>

调试日志信息

参数信息中相关的信息

env.MAVEN_CMD_LINE_ARGS=tomcat7:redeploy -Pweb-build -Ptomcat -Dmaven.test.skip=true -Dmaven.tomcat.url=http://10.10.5.48:6006/manager/text -X, 

部署及其前相关信息

[INFO] <<< tomcat7-maven-plugin:2.2:redeploy (default-cli) @ sproc4gd-web <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:redeploy (default-cli) @ sproc4gd-web ---
[DEBUG] Configuring mojo org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:redeploy from plugin realm ClassRealm[plugin>org.apache.tomcat.maven:tomcat7-maven-plugin:2.2, parent: sun.misc.Launcher$AppClassLoader@76ea7776]
[DEBUG] Configuring mojo 'org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:redeploy' with basic configurator -->
[DEBUG]   (f) charset = ISO-8859-1
[DEBUG]   (f) contextFile = D:\SPROC4GD\08_branches\sproc4gd_2.1\sproc4gd-web\sproc4gd-web\src\main\tomcatconf\context.xml
[DEBUG]   (f) ignorePackaging = false
[DEBUG]   (f) mode = war
[DEBUG]   (f) packaging = war
[DEBUG]   (f) password = tomcat
[DEBUG]   (f) path = /web
[DEBUG]   (f) server = tomcat
[DEBUG]   (f) update = true
[DEBUG]   (f) url = http://localhost:8080/manager/html
[DEBUG]   (f) username = tomcat
[DEBUG]   (f) version = 2.2
[DEBUG]   (f) warFile = D:\SPROC4GD\08_branches\sproc4gd_2.1\sproc4gd-web\sproc4gd-web\target\web.war
[DEBUG]   (f) settings = org.apache.maven.execution.SettingsAdapter@199bd995
[DEBUG] -- end configuration --
[INFO] Deploying war to http://localhost:8080/web  

加载中
0
x
xiaozhaolh

大概找到原因了。

项目POM中有这段配置
<parent>
<groupId>com.***.sproc</groupId>
<artifactId>sproc-project</artifactId>
<version>1.3.7</version>
</parent>

本地仓库从sproc-project继承的POM定义如下
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- http port -->
<port>7007</port>
<!--<url>http://localhost:8080/manager/text</url>-->
<server>tomcat</server>
<!-- application path always starts with /-->
<path>/${project.build.finalName}</path>
<!-- optional path to a context file -->
<contextFile>src/main/tomcatconf/context.xml</contextFile>
<uriEncoding>UTF-8</uriEncoding>
<username>tomcat</username>
<password>tomcat</password>
<update>true</update>
<!-- if you want to use test dependencies rather than only runtime -->
<useTestClasspath>false</useTestClasspath>
</configuration>
</plugin>


如何配置能让项目中定义的配置能覆盖继承的配置呢?

返回顶部
顶部