我正在尝试使用远程Glassfish服务器(版本3.1.1(版本12))上的Cargo Maven插件部署Web应用程序.Glassfish服务器以及位于不同Linux服务器(Ubuntu)上的Java代码.我已经在pom文件中配置了所有必需的属性,并在Windows机器上进行了测试部署.有用.但它在Linux Ubuntu上失败了,有一个有趣的例外:
27-Jun-2012 14:36:05 [ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.2.1:deploy (default-cli) on project my-web-project-app: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.2.1:deploy failed: Deployment has failed: null -> [Help 1]
27-Jun-2012 14:36:05 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.2.1:deploy (default-cli) on project mca-staff-app: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.2.1:deploy failed: Deployment has failed: null
27-Jun-2012 14:36:05 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
27-Jun-2012 14:36:05 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
27-Jun-2012 14:36:05 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
27-Jun-2012 14:36:05 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
27-Jun-2012 14:36:05 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
27-Jun-2012 14:36:05 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
27-Jun-2012 14:36:05 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
27-Jun-2012 14:36:05 …Run Code Online (Sandbox Code Playgroud) 我有一个maven项目,我想使用Cargo-Maven-Plugin(1.1.1)来启动和停止tomcat服务器来运行集成测试.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<container>
<type>installed</type>
<containerId>tomcat6x</containerId>
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip</url>
</zipUrlInstaller>
</container>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
启动服务器工作正常,但停止总是失败.
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.1.1:stop (stop-container) on project test: Execution stop-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.1.1:stop failed: Failed to stop the Tomcat 6.x container. Server port 8080 did not shutdown within the timeout period [120000] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.1.1:stop (stop-container) on project test: …Run Code Online (Sandbox Code Playgroud) 我找不到任何关于如何通过maven将简单的基于Maven的项目部署到远程GlassFish服务器的明确答案
mvn package xxx:deploy
Run Code Online (Sandbox Code Playgroud)
我认为只有货物插件支持GlassFish 3.对吧?
我在配置方面遇到了问题.
任何示例远程GlassFish部署都会很棒.货物不是必须的,如果其他人支持远程GlassFish,那么我们也可以使用它.
如果可能的话,我想将Tomcat的context.xml文件保留在WAR文件的META-INF目录之外.这可以用Maven的货物插件完成吗?我似乎找不到正确的配置.
我试图在我的build.gradle文件中有多个Gradle任务来将战争部署到不同的环境.我希望能够有一个deployToLocal沿任务deployToQA和deployToDev已经生成一个war文件之后.
当然,这意味着我想停止Tomcat服务,删除Tomcat webapps目录中的现有war文件和扩展的war,复制war,然后重新启动Tomcat以部署服务.
我的问题是双重的:
我的代码到目前为止:
task deleteDirLocalhost(type: Delete){
//delete fileTree(dir: local_Tomcat_webapps_dir)
delete fileTree(dir: 'C:\\Tomcat7.0\\webapps')
}
task deployToLocal{
dependsOn war, tomcatStop, deleteDirLocalhost
println "Starting Cargo"
println "Using war from: $warLocation" // warLocation is a variable defined in gradle.properties file
cargo {
containerId = 'tomcat7x'
port = TomcatPortLocalhost as Integer
local {
homeDir = file(local_Tomcat_webapps_dir) // local_Tomcat_webapps_dir is a variable defined in gradle.properties file
}
deployable {
file = file(warLocation) // This …Run Code Online (Sandbox Code Playgroud) 我试图使用货物插件在tomcat8上部署战争我的条目如下:
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.8</version>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.username>tomcat</cargo.remote.username>
<cargo.remote.password>s3cret</cargo.remote.password>
<cargo.tomcat.manager.url>http://localhost:1234/manager/text</cargo.tomcat.manager.url>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<properties>
<context>/auditAPP</context>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用mvn货物运行时:部署它给我以下错误
无法执行目标org.codehaus.cargo:cargo-maven2-plugin:1.4.8:部署(default-cli)项目Audit_Management_DS:执行default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4. 8:部署失败:无法创建配置.参数没有注册配置(容器[id = [tomcat8x],type = [remote]],配置类型[runtime]).实际上,没有为此配置注册的有效类型.也许你拼错了? - > [帮助1]
我正在尝试在我的货物配置中启用调试.我正在使用具有以下配置的cargo-maven2-plugin版本1.4.19.
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.19</version>
<configuration>
<container>
<containerId>tomcat8x</containerId>
</container>
<configuration>
<type>standalone</type>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<cargo.jvmargs>
-Xmx2048m
-Xms512m
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=63342
-Xnoagent
-Djava.compiler=NONE
</cargo.jvmargs>
</properties>
</configuration>
<deployer>
</deployer>
<deployables>
<deployable type="war" file="target/spa.war"></deployable>
</deployables>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
应用程序使用此配置启动,但IntelliJ从不连接到JVM以启用debuging.如何使IntelliJ连接到JVM?
我正在使用Cargo Maven插件将WAR部署到远程服务器,我遇到了问题.我可能会为这个问题创建第二个问题,但是这个问题是关于覆盖Maven插件的log4j配置.Cargo使用JBoss的客户端库将东西发送到JBoss服务器(我正在尝试这样做.)JBoss库使用log4j.Cargo没有设置我所知道的任何类型的映射层.
因此,基本上,日志消息发生在Maven插件的依赖库中.我尝试设置-Dlog4j.debug并获取此信息:
Run Code Online (Sandbox Code Playgroud)log4j: Trying to find [log4j.xml] using ClassRealm[plugin>org.codehaus.cargo:cargo-maven2-plugin:1.0.5, parent: ClassRealm[maven.api, parent: null]] class loader. log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource(). log4j: Trying to find [log4j.properties] using context classloader ClassRealm[plugin>org.codehaus.cargo:cargo-maven2-plugin:1.0.5, parent: ClassRealm[maven.api, parent: null]]. log4j: Using URL [jar:file:/C:/Users/username/.m2/repository/org/jboss/jbossts/jbossjts/4.13.1.Final/jbossjts-4.13.1.Final.jar!/log4j.properties] for automatic log4j configuration. log4j: Reading configuration from URL jar:file:/C:/Users/username/.m2/repository/org/jboss/jbossts/jbossjts/4.13.1.Final/jbossjts-4.13.1.Final.jar!/log4j.properties log4j: Could not find root logger information. Is this OK? log4j: Parsing for [com.arjuna] with value=[INFO, default, stdout]. log4j: Level token is [INFO]. log4j: Category com.arjuna set …
使用来自cargo-maven2-plugin的run mojo,我想知道关闭容器的更好方法.
控制台输出显示Ctrl + C停止,但似乎什么也没做.
如果我终止,它会留下一个孤儿java.exe进程,我必须自杀.
难道我做错了什么?这有点麻烦.
编辑:我在独立配置中使用Tomcat.如果我使用嵌入式Jetty,自然终止工作,但我们需要Tomcat.
我正在开发一个Jenkins插件,它使用Codehaus Cargo Java API管理EAR文件到Java EE容器的部署,但是在使用API部署到远程Wildfly容器时我遇到了一个问题.在部署到其他容器(如Glassfish)时,代码工作正常,但在尝试将EAR文件部署到Wildfly容器时,将XNIO001001: No XNIO provider found返回错误消息.
我花了几个小时研究这个问题,但我找不到任何可能解决问题的方法.尝试部署到在Windows和Ubuntu上运行的Wildfly 8.1和8.2时会发生此问题.我还检查了Wildfly服务器日志,但它不包含与此问题相关的任何内容.
我的问题是,XNIO001001: No XNIO provider found当代码是Jenkins插件的一部分时,我可以做什么来防止部署到Wildfly容器时出现错误?
我知道Jenkins已经有了类似的插件,并且Cargo可以与Maven一起使用来部署到容器,但这两个选项都不符合我的特定要求.
我编写的用于部署EAR文件的代码如下:
public void redeploy(String containerId, String deployFile, String hostname, String username, String password) {
DeployableFactory deployableFactory = new DefaultDeployableFactory();
Deployable deployable = deployableFactory.createDeployable(containerId, deployFile, DeployableType.EAR);
ConfigurationFactory configurationFactory = new DefaultConfigurationFactory();
Configuration configuration = configurationFactory.createConfiguration(containerId, ContainerType.REMOTE, ConfigurationType.RUNTIME);
configuration.setProperty("cargo.hostname",hostname);
configuration.setProperty("cargo.remote.username", username);
configuration.setProperty("cargo.remote.password", password);
ContainerFactory containerFactory=new DefaultContainerFactory();
Container container = containerFactory.createContainer(containerId, ContainerType.REMOTE, configuration);
DeployerFactory deployerFactory = new DefaultDeployerFactory();
Deployer deployer = …Run Code Online (Sandbox Code Playgroud) cargo ×10
maven ×6
tomcat ×5
java ×3
glassfish ×2
maven-cargo ×2
build.gradle ×1
deployment ×1
eclipse ×1
glassfish-3 ×1
gradle ×1
jenkins ×1
linux ×1
log4j ×1
m2e ×1
maven-plugin ×1
tomcat6 ×1
ubuntu ×1
wildfly ×1