我试图在我的Maven项目中使用Cargo插件,以便从针对Jonas服务器的战争热部署中受益。
官方文档不清楚支持什么和不支持什么(例如,您可以找到以下内容:http : //cargo.codehaus.org/Hot+Deployment以及此http://cargo.codehaus.org/JOnAS + 4.x)。
无论如何,对于战争的POM,我具有以下含义:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<configuration>
<container>
<containerId>jonas4x</containerId>
<home>C:\JOnAS-4.8.4\nt\bin</home>
</container>
<configuration>
<type>existing</type>
<home>C:\JOnAS-4.8.4</home>
</configuration>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
当我跑步时
mvn cargo:deploy
Run Code Online (Sandbox Code Playgroud)
在我的项目中,战争已复制到Jonas webapps文件夹,但没有热部署。仅复制文件,但不调用hot deploy Jonas命令,因此无法立即使用我的修改。
编辑:我也尝试按照答案中的建议添加部署程序配置,但行为是相同的(即:复制了war,但未调用Jonas hot deploy命令,以便不会在Jonas中重新加载war)。
我是否缺少某些信息?或者我说的是Cargo Maven插件不支持Jonas Hot Deployement吗?
提前致谢!
我想让我的集成测试在http://localhost:8080/messaging 上命中货物的 tomcat,但货物 (cargo-maven2-plugin:1.0.5) 更喜欢将我的消息传递项目部署为 /messaging-0.0.7-SNAPSHOT,如在 tomcat 管理控制台和 target\tomcat6x\webapps 目录中看到。
所以我尝试将这些行添加到货物配置中,认为它会选择默认工件:
<deployer>
<deployables>
<deployable>
<properties>
<context>/messaging</context>
</properties>
</deployable>
</deployables>
</deployer>
Run Code Online (Sandbox Code Playgroud)
但事实并非如此。它甚至没有尝试,因为我在 target\tomcat6x\webapps 目录中没有看到消息或消息 0.0.7-SNAPSHOT。
当我像这样设置它时会发生同样的事情:
<configuration>
<type>standalone</type>
<wait>false</wait>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<cargo.logging>high</cargo.logging>
</properties>
<deployer>
<deployables>
<deployable>
<groupId>com.company.platform</groupId>
<artifactId>messaging</artifactId>
<type>war</type>
<properties>
<context>/messaging</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这是完整的插件配置:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<type>standalone</type>
<wait>false</wait>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<cargo.logging>high</cargo.logging>
</properties>
<deployer>
<deployables>
<deployable>
<properties>
<context>/messaging</context>
</properties> …Run Code Online (Sandbox Code Playgroud) 我使用maven货物和硒进行自动化.这是代码:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.5</version>
<configuration>
<wait>false</wait>
<container>
<containerId>tomcat6x</containerId>
<zipUrlInstaller>
<url>
http://mirrors.enquira.co.uk/apache/tomcat/tomcat-6/v6.0.30/bin/apache-tomcat-6.0.30.zip
</url>
<installDir>${installDir}</installDir>
</zipUrlInstaller>
<output>
${project.build.directory}/tomcat6x.log
</output>
<log>${project.build.directory}/cargo.log</log>
</container>
<configuration>
<home>
${project.build.directory}/tomcat6x/container
</home>
<properties>
<cargo.logging>high</cargo.logging>
<cargo.servlet.port>8081</cargo.servlet.port>
</properties>
<files>
<copy>
<file>${project.basedir}/src/main/resources/datasource.properties</file>
<todir>webapps</todir>
<configfile>true</configfile>
<overwrite>true</overwrite>
</copy>
</files>
<properties>
<customMessage>${catalina.home}</customMessage>
</properties>
</configuration>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>configure</goal>
<goal>start</goal>
<goal>deploy</goal>
</goals>
<configuration>
<deployer>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<pingURL>**the url**</pingURL>
<pingTimeout>180000</pingTimeout>
<properties>
<context>**war-name**</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
Run Code Online (Sandbox Code Playgroud)
但随着战争开始变得越来越大,pingtimeout开始增加,我不想使用ping超时,但我现在被迫,因为部署需要一点时间,如果没有提到pingtimeout,selenium不会等待.
有没有解决这个问题的方法?
我刚才下面的代码添加到我的pom.xml(如在指定的位置):
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.12/bin/apache-tomcat-7.0.12.zip</url>
</zipUrlInstaller>
</container>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
但是,当我跑步时,mvn clean verify cargo:run我得到以下内容:
No plugin found for prefix 'cargo' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo]
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
我正在尝试使用cargo-maven插件构建并重新部署到远程tomcat 7服务器.我已成功部署到远程服务器,但所有其他操作都失败了.
这是我的pom.xml中的插件设置
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<!-- Container configuration -->
<container>
<containerId>tomcat7x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.username>tomcat</cargo.remote.username>
<cargo.remote.password>tomcat</cargo.remote.password>
<cargo.remote.uri>http://devserver:8080/manager/html</cargo.remote.uri>
</properties>
</configuration>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
这是我在eclipse中看到的错误,当我尝试部署时.我将它发布到pastebin,因此更容易阅读.错误链接.非常感谢任何帮助.
有人成功地将EAR远程部署到JBoss 5.1.0.GA吗?我的pom.xml配置如下:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.1-SNAPSHOT</version>
<configuration>
<container>
<containerId>jboss51x</containerId>
<type>remote</type>
<timeout>600000</timeout>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.username>username</cargo.remote.username>
<cargo.remote.password>password</cargo.remote.password>
<cargo.hostname>myserver</cargo.hostname>
<cargo.servlet.port>8888</cargo.servlet.port>
</properties>
</configuration>
<deployer>
<type>remote</type>
<deployables>
<deployable>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
这会导致以下错误消息:
java.io.IOException: Server returned HTTP response code: 500 for URL:
http://myserver:8888/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=file:d%3A%5Cear%5Cmy-ear-1.0-SNAPSHOT.ear
Run Code Online (Sandbox Code Playgroud) 我使用maven货物及其zip url安装程序功能下载tomcat进行集成测试.这在我的计算机上工作正常,但是当它在husdon中运行时有时会失败(大约10-20%).
失败的是:
Error while expanding /home/hudson/workspace/My Test Media-Archive/cfma/target/cargo/install/apache-tomcat-6.0.32.zip
java.io.IOException: Negative seek offset
at org.apache.tools.ant.taskdefs.Expand.expandFile(Expand.java:148)
at org.apache.tools.ant.taskdefs.Expand.execute(Expand.java:107)
at org.codehaus.cargo.container.installer.ZipURLInstaller.unpack(ZipURLInstaller.java:252)
at org.codehaus.cargo.container.installer.ZipURLInstaller.install(ZipURLInstaller.java:149)
at org.codehaus.cargo.maven2.configuration.Container.setupHome(Container.java:357)
at org.codehaus.cargo.maven2.configuration.Container.createContainer(Container.java:241)
at org.codehaus.cargo.maven2.AbstractCargoMojo.createNewContainer(AbstractCargoMojo.java:470)
at org.codehaus.cargo.maven2.AbstractCargoMojo.createContainer(AbstractCargoMojo.java:410)
at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(ContainerStartMojo.java:53)
at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:268)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:182)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:65)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at hudson.maven.agent.Main.launch(Main.java:173)
at hudson.maven.MavenBuilder.call(MavenBuilder.java:164)
at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:861)
at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:792)
at hudson.remoting.UserRequest.perform(UserRequest.java:114) …Run Code Online (Sandbox Code Playgroud) 因此,我想做的是自动化我的 JMeter 测试过程,为此,我使用 Cargo 部署到 Tomcat 容器并在那里运行 JMeter 脚本,并使用基于以下描述的 pom:- http: // /www.alexecollins.com/content/jmeter-integration-test-template-pom/ 之后,我付出了很多努力才让它工作。
但是,现在当然为了测试我想使用 testdb 而不是我的实际数据库,为此我需要一个自定义 context.xml (而不是我的生产 context.xml ,一切都可以使用),其中使用 jndi 我定义 jdbc 参数。
因此,我计划有一个 testcontext.xml,我将货物复制到容器中,同时使用货物的复制配置文件选项之类的东西运行 JMeter 测试 - http://cargo.codehaus.org/Custom+File+Configurations。但它似乎不起作用。我已经调试了几个小时了,但无法弄清楚。
我正在粘贴 test-depolyer 模块的 pom 文件,该模块具有要在此处部署的所有其他模块的依赖项:-
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.parentname</groupId>
<artifactId>product-services</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.parentname.product-services</groupId>
<artifactId>test-deployer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>com.parentname.product-services</groupId>
<artifactId>product1-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>default</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<tasks>
<delete …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Maven 3 中运行嵌入式 Tomcat 9 以进行集成测试。我是cargo-maven2-plugin由其他 SO 答案引导的。
因此,尝试按照此处找到的说明进行操作:
https://codehaus-cargo.github.io/cargo/Static+deployment+of+WAR.html
我在一个简单的 POM 中有这个片段:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.7.6</version>
<configuration>
<container>
<containerId>tomcat9x</containerId>
<type>embedded</type>
</container>
<deployables>
<deployable>
<type>war</type>
<properties>
<file>path/to/myapp.war</file>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我尝试执行 mvn org.codehaus.cargo:cargo-maven2-plugin:run
它失败并出现错误:
[INFO] [en2.ContainerRunMojo] 已解决容器构件 org.codehaus.cargo:cargo-core-container-tomcat:jar:1.7.6 for container tomcat9x [警告] 定义的可部署与项目的主要构件具有相同的 groupId 和 artifactId但类型不同。您已经定义了一个 [war] 类型,其中项目的包装是 [pom]。这可能是一个错误,因此插件将尝试在项目的依赖项中找到这个可部署的。
我怎样才能使这项工作?我只想在 Maven 中的嵌入式 tomcat9 中启动给定的 WAR。
我正在准备一个maven2 web项目以进行持续集成.在运行集成测试之前,我使用maven cargo插件自动将WAR部署到Tomcat6x.
我的代码取决于一些设置的系统属性MAVEN_OPTS=-Dfoo=bar.不幸的是,当应用程序部署到Tomcat时,这些属性丢失了:
System.getProperty("foo"); // null, when deployed to container by maven-cargo
Run Code Online (Sandbox Code Playgroud)
如何将这些属性传递给Tomcat?