【发布时间】:2011-09-25 00:16:48
【问题描述】:
当我在具有<packaging>war</packaging> 的项目中运行mvn deploy 时,我收到错误:
[错误] 无法在项目 store-service-impl 上执行目标 org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy):部署失败:存储库元素未在在 distributionManagement 元素或 -DaltDeploymentRepository=id::layout::url 参数中的 POM
似乎默认情况下,deploy:deploy 目标绑定到 deploy 生命周期阶段。换句话说,当 deploy 生命周期阶段运行时,Maven 将尝试将生成的工件(在本例中为 .war 文件)部署到远程存储库。
就我而言,我想将战争部署到远程 Tomcat 实例而不是远程 Maven 存储库。我已将以下内容添加到pom.xml
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<type>remote</type>
</container>
<!--
<executions>
<execution>
<id>deploy-tomcat</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
-->
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.uri>http://10.60.60.60:8080/manager</cargo.remote.uri>
<cargo.remote.username>jack</cargo.remote.username>
<cargo.remote.password>secret</cargo.remote.password>
</properties>
</configuration>
<deployer>
<type>remote</type>
</deployer>
</configuration>
</plugin>
当我运行 mvn cargo:deploy 时,这成功部署了 .war。但是,如果我随后通过取消注释 <executions> 元素将此目标绑定到 Maven 生命周期的 deploy 阶段,则会收到上述错误。
似乎cargo:deploy 目标已添加到绑定到deploy 阶段的目标中,但我想替换 绑定到deploy 的deploy:deploy 目标cargo:deploy 目标的生命周期阶段(默认),这可能吗?
【问题讨论】: