-->

凡货物生成语境XML的码头6.x的?(Where is Cargo generating conte

2019-07-29 00:06发布

我想实现中提到的解决方案如何指定码头-env.xml文件Maven的货物插件码头?

不过我现在面临更根本的东西:我的货根本就没有产生任何上下文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>

其基本思想是,我们提供了一个自定义的context.xml更换所产生的一个。 然而,当我尝试了,我无法找到货物产生的任何上下文XML(请注意,我说的自定义配置文件,并与cargo.jetty.createContextXml为真)

我不知道这是否是我的设置问题,导致没有产生的背景,或产生的背景地方我忽视。 我有目标/货运/和温度是货物扩大了我的WAR目录下检查,既没有地方包含上下文XML。

(我使用Maven 2.2.1,1.2.1货物,JDK 6)

Answer 1:

我不是100%肯定你的问题是什么,但这里是货物做我的Jetty6系统。

该目录所在的码头安装不是在运行时上下文和Web应用程序文件。 在我的情况下,它们被存储在Java临时目录(即java.io.tmpdir )。 在我的Ubuntu系统中,这是/tmp 。 这个目录下,有一个cargo/conf目录。 在/tmp/cargo/conf我有其中一个上下文目录context.xml文件存储-虽然该文件的实际名称是从来没有context.xml它的Web应用程序上下文之后总是被命名。

在我的情况下,此文件被相同的名字,因为我与配置货物的上下文。 因为我注意到,你和我一样没有提供上下文这里可能在于你的问题:

<deployables>
    <deployable>
       <properties>
         <!-- Web root context URL -->
         <context>${build.appserver.context}</context>
       </properties>
    </deployable>
</deployables>

其次,我也注意到你有评论指出,地方context.xml文件在正确的地方的部分。 除非你取消注释,这是行不通的。

第三,你设置的值${jetty6.context} Maven的财产?

第四 - 我觉得这个工作你需要使用码头的独立配置。 这不应该是一个问题,因为货物会自动下载并安装它。 看到这里我的配置:

  <container> <containerId>jetty6x</containerId> <!-- Using Jetty for build portability so type != "remote". For Jetty would prefer type = "embedded" but we must go with "installed" because jetty-env.xml file would be ignored. See http://jira.codehaus.org/browse/CARGO-861 --> <type>installed</type> <zipUrlInstaller> <url>http://dist.codehaus.org/jetty/jetty-6.1.26/jetty-6.1.26RC0.zip</url> <installDir>${build.working}</installDir> </zipUrlInstaller> <dependencies> <!-- The following dependencies are added to the servlet container's classpath as if they were installed by a system admin. In order to be included here, they need to be listed as dependencies in this pom.xml. --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc5</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>net.sourceforge.jtds</groupId> <artifactId>jtds</artifactId> </dependency> </dependencies> </container> <!-- Do not hang and wait for a client, just do it --> <wait>false</wait> <configuration> <!-- Deployer configuration --> <!-- Running Jetty container with type=installed (eg local) so type != "runtime", and we are installing it during this execution for the sake of portability so type != "existing" --> <type>standalone</type> <properties> <!-- Use the port number from settings.xml --> <cargo.servlet.port>${build.appserver.port}</cargo.servlet.port> </properties> <deployables> <deployable> <properties> <!-- Web root context URL --> <context>${build.appserver.context}</context> </properties> </deployable> </deployables> <configfiles> <configfile> <file>${basedir}/target/jetty-context.xml</file> <todir>contexts</todir> <tofile>${build.appserver.context}.xml</tofile> </configfile> </configfiles> </configuration> 


文章来源: Where is Cargo generating context XML for Jetty 6.x?