我目前正在尝试使用货物通过Atlassian的竹子在远程玻璃鱼3.1.2上部署应用程序。这是一个开发环境,因此每次将具有不同版本号的同一应用程序部署在同一上下文根目录上。
但是每次我执行目标时都达到了目标:
org.codehaus.cargo:cargo-maven2-plugin:redeploy
我不断收到错误:
11-Jun-2013 15:13:48 Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.2:redeploy failed: Deployment has failed: Action failed Deploying application to target server failed; Error occurred during deployment: Application with name myapp-1.4.8 is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name. Please see server.log for more details. 11-Jun-2013 15:13:48 11-Jun-2013 15:13:48 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110) 11-Jun-2013 15:13:48 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 11-Jun-2013 15:13:48 ... 19 more 11-Jun-2013 15:13:48 Caused by: org.codehaus.cargo.util.CargoException: Deployment has failed: Action failed Deploying application to target server failed; Error occurred during deployment: Application with name myapp-1.4.8 is already registered. Either specify that redeployment must be forced, or redeploy the application. Or if this is a new deployment, pick a different name. Please see server.log for more details. 11-Jun-2013 15:13:48 11-Jun-2013 15:13:48 at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.waitForProgressObject(AbstractJsr88Deployer.java:285) 11-Jun-2013 15:13:48 at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.deploy(AbstractJsr88Deployer.java:123) 11-Jun-2013 15:13:48 at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.redeploy(AbstractJsr88Deployer.java:207) 11-Jun-2013 15:13:48 at org.codehaus.cargo.maven2.DeployerRedeployMojo.performDeployerActionOnSingleDeployable(DeployerRedeployMojo.java:50) 11-Jun-2013 15:13:48 at org.codehaus.cargo.maven2.AbstractDeployerMojo.performDeployerActionOnAllDeployables(AbstractDeployerMojo.java:180) 11-Jun-2013 15:13:48 at org.codehaus.cargo.maven2.AbstractDeployerMojo.doExecute(AbstractDeployerMojo.java:97) 11-Jun-2013 15:13:48 at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:432) 11-Jun-2013 15:13:48 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 11-Jun-2013 15:13:48 ... 20 more 11-Jun-2013 15:13:48 [ERROR] 11-Jun-2013 15:13:48 [ERROR] 11-Jun-2013 15:13:48 [ERROR] For more information about the errors and possible solutions, please read the following articles: 11-Jun-2013 15:13:48 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException 11-Jun-2013 15:13:48 [ERROR] 11-Jun-2013 15:13:48 [ERROR] After correcting the problems, you can resume the build with the command
我需要的是cargo插件强制重新部署,而不管该上下文根是否已存在应用程序(旧版本)。
如果我是手动运行asadmin命令,则可以轻松添加–force参数,它将起作用。
我还有一个额外的约束,我无法在托管Bamboo实例的服务器上安装本地版本的glassfish,因此无法使用maven sh插件之类的内容手动构建asadmin命令。
以下是相关的pom.xml片段:
<build> <finalName>myapp-${project.version}</finalName> <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.4.2</version> <configuration> <container> <containerId>glassfish3x</containerId> <type>remote</type> </container> <configuration> <type>runtime</type> <properties> <cargo.remote.username>${cargo.remote.username}</cargo.remote.username> <cargo.remote.password>${cargo.remote.password}</cargo.remote.password> <cargo.glassfish.admin.port>${cargo.glassfish.admin.port}</cargo.glassfish.admin.port> <cargo.hostname>${cargo.hostname}</cargo.hostname> </properties> </configuration> </configuration> <dependencies> <dependency> <groupId>org.glassfish.deployment</groupId> <artifactId>deployment-client</artifactId> <version>3.1.1</version> </dependency> </dependencies> </plugin>
有任何想法吗?
我终于找到了如何通过稍微修改我的应用程序的部署和版本控制方式以及使用glassfish的应用程序版本控制系统来实现此目的的方法。以下是我写的一个小博客文章的链接,以显示如何实现此目的:
博客文章-使用货运插件部署到远程glassfish