我使用以下命令序列调用maven
C:>\mvn install tomcat7:redeploy
这会产生以下(严重)编辑的输出
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ geomaster ---
[INFO] Copying 0 resource
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ geomaster ---
[INFO] No sources to compile
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ geomaster ---
[INFO] Copying 0 resource
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ geomaster ---
[INFO] No sources to compile
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ geomaster ---
[INFO] --- maven-war-plugin:2.2:war (default-war) @ geomaster ---
[INFO] --- maven-install-plugin:2.4:install (default-install) @ geomaster ---
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:redeploy (default-cli) @ geomaster >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ geomaster ---
[INFO] Copying 0 resource
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ geomaster ---
[INFO] No sources to compile
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ geomaster ---
[INFO] Copying 0 resource
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ geomaster ---
[INFO] No sources to compile
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ geomaster ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO] --- maven-war-plugin:2.2:war (default-war) @ geomaster ---
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:redeploy (default-cli) @ geomaster <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:redeploy (default-cli) @ geomaster ---
请忽略项目中没有资源或源代码的事实。这不是问题的症结所在。
install
目标用于将生成的战争放入maven存储库。 tomcat7:redeploy
目标用于将生成的war放入tomcat服务器。
我尝试了各种调用和不同的配置但是我无法阻止tomcat插件执行它自己的构建,尽管install
目标刚刚完成它。
surefire插件似乎有一些智能&#39;因为它已经检测到它已经运行过。为什么不能拥有这样的智慧&#39;也?
有关tomcat插件的更多信息,请访问:tomcat7-maven-plugin
虽然tomcat插件执行的第二个构建不会做任何实质性的事情,即使在一个更实质的项目中,我怎么能防止它被执行,因为它完全是多余的?
这是maven还是tomcat插件中的错误?这可以作为增强请求的基础吗?或者这种必须与之共存的预期行为?
答案 0 :(得分:0)
从链接到deploy
goal的Tomcat页面,它说明了它:
在执行之前调用lifecycle phase包的执行。
这就是为什么它正在进行自己的构建。这是一个刻意的功能,据我所知,不能关闭。
但deploy-only
目标存在:
将WAR部署到Tomcat而不会使包生命周期
因此,如果您将命令更改为:
mvn install tomcat7:deploy-only
那么它应该做你想做的事。