Maven 2 Cargo在哪里为Jetty 6.x生成上下文XML?
我正在尝试实施中提到的解决方案 然而,我面临着更基本的问题:我的货物根本不生成任何上下文xmlMaven 2 Cargo在哪里为Jetty 6.x生成上下文XML?,maven-2,jetty,cargo,maven-cargo,Maven 2,Jetty,Cargo,Maven Cargo,我正在尝试实施中提到的解决方案 然而,我面临着更基本的问题:我的货物根本不生成任何上下文xml <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.2.1</version> <configuration>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<!-- Container configuration -->
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
</container>
<!-- Configuration to use with the container or the deployer -->
<configuration>
<properties>
<cargo.servlet.port>${itest.webapp.port}</cargo.servlet.port>
<cargo.jetty.createContextXml>true</cargo.jetty.createContextXml>
</properties>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>myApp-web</artifactId>
<type>war</type>
<properties>
<context>/myApp</context>
</properties>
</deployable>
</deployables>
<!--
<configfiles>
<configfile>
<file>${project.build.outputDirectory}/jetty-env.xml</file>
<todir>contexts</todir>
<tofile>${jetty6.context}.xml</tofile>
</configfile>
</configfiles>
-->
</configuration>
</configuration>
<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>
</plugin>
基本思想是,我们提供了一个自定义context.xml来替换生成的context.xml。但是,当我尝试时,我找不到Cargo生成的任何上下文XML。请注意,我已经注意到自定义配置文件,Cargo.jetty.createContextXml为true
我不确定是我的设置问题导致了上下文没有生成,还是上下文是在我忽略的地方生成的。我在target/cargo/和temp目录下检查了cargo扩展了我的WAR,这两个地方都不包含上下文xml
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<!-- Container configuration -->
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
</container>
<!-- Configuration to use with the container or the deployer -->
<configuration>
<properties>
<cargo.servlet.port>${itest.webapp.port}</cargo.servlet.port>
<cargo.jetty.createContextXml>true</cargo.jetty.createContextXml>
</properties>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>myApp-web</artifactId>
<type>war</type>
<properties>
<context>/myApp</context>
</properties>
</deployable>
</deployables>
<!--
<configfiles>
<configfile>
<file>${project.build.outputDirectory}/jetty-env.xml</file>
<todir>contexts</todir>
<tofile>${jetty6.context}.xml</tofile>
</configfile>
</configfiles>
-->
</configuration>
</configuration>
<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>
</plugin>
我正在使用Maven 2.2.1、Cargo 1.2.1、JDK 6我不能100%确定您的问题是什么,但下面是Cargo在Jetty6系统上的作用 Jetty安装所在的目录不是运行时上下文和webapp文件所在的目录。在我的例子中,它们存储在Java temp目录中,即Java.io.tmpdir。在我的Ubuntu系统上,这是/tmp。在这个目录下,有一个cargo/conf目录。在/tmp/cargo/conf下,我有一个context目录,其中存储了context.xml文件——尽管文件的实际名称永远不是context.xml,但它总是以web应用程序上下文命名 在我的例子中,这个文件的名称与我配置货物的上下文的名称相同。这里可能存在您的问题,因为我注意到您没有像我一样提供上下文:
<deployables>
<deployable>
<properties>
<!-- Web root context URL -->
<context>${build.appserver.context}</context>
</properties>
</deployable>
</deployables>
我之所以说这两行是为了检查我是否可以看到生成context.xml的货物,即使我没有提供一行,我想看看里面最初是什么,但最后我看不到。我想我已经提供了上下文路径/myApp。我可以再试一次,看看我是否能找到你提到的关于货物/配置的地方。非常感谢你的帮助我想知道货物的逻辑是否改变了。。。我的结果是,在target/下创建了cargo目录,其中包含配置/jetty6x/etc/,但没有上下文/。在临时目录中,将创建一个包含提取的war内容的目录。这似乎与您的观察结果大不相同,因此我担心cargo在之后发生了很大变化:我正在运行Maven cargo插件1.0.3版,但我想我刚刚意识到问题所在……嵌入式Jetty无法实现这一点。尝试使用独立配置。请看我修改后的答案。事实上,我正准备用自动安装程序试用已安装的Jetty。因为我们公司的网络有点受限,我打算用Jetty7x尝试这个解决方案,安装程序可以作为依赖项下载。非常感谢你的帮助。希望这次我能得到这份工作我会先尝试Jetty6,因为我们知道它是有效的。我还将尝试使用1.0.3以及我的配置来验证一切正常,然后根据需要一步一步地进行修改。如果我的答案有帮助的话,也可以随意投票或检查我的答案。祝你好运,我是货运队的阿里·托克曼。我很高兴地宣布,这一点现在已完全记录在“享受”中!