0

hudson を使用して war ファイルを作成したいと考えています。次の手順で行いました。

1. プロジェクトに build.xml を作成しました。

2.その ant ファイルでは、アプリケーションをコンパイルして war を作成するためのターゲットを提供しています。

3.次に、構築オプション、つまり ant による呼び出しを提供する hudson ジョブを作成しました。展開オプションでは、戦争を展開する必要がある weContainer を提供します。

4.戦争を作成し、Webコンテナにも展開します。

しかし、それは正しい方法ですか?

ありがとう、

4

1 に答える 1

1

maven cargo plugin と copy artifact plugin を使用して、hudson を使用して war をデプロイできます。サーバー管理者を提供します。Apache Tomcat にユーザーを追加します。

<!-- Configuration for the Maven build -->
<build>
    <!-- The plugins tag as mandated by maven -->
    <plugins>
        <!-- Start's the plugin tag for Cargo! -->
        <plugin>
            <!-- Cargo Group Id -->
            <groupId>org.codehaus.cargo</groupId>
            <!-- Cargo's Artifact Id -->
            <artifactId>cargo-maven2-plugin</artifactId>
            <!-- This the most important part of the setup -->
            <configuration>
                <!--
                    When Cargo starts the container, the following tag instructs it to
                    wait for you to kill the session with Crtl-C
                -->
                <wait>true</wait>
                <!--
                    The following tag details the container you want to
                    deploy to.
                -->
                <container>
                    <!--
                        Specifying "tomcat6x" is very important! This one tripped me up
                        for quite a while. The issue is that instead of being an
                        identifier for you, "tomcat6x" is an identifier for Cargo that
                        you want to deploy your webapp in Tomcat 6.x. I had initially
                        thought otherwise and hence just dropped the 'x', making it
                        "tomcat6", but that never worked.
                    -->
                    <containerId>tomcat6x</containerId>
                    <!--
                        Type == Installed means that you want to deploy to a container
                        that's installed on your computer
                    -->
                    <type>installed</type>
                    <!-- The home folder for your local Tomcat -->
                    <home>${catalina.home}</home>
                </container>
                <configuration>
                    <!--
                        This is another one that confused me for long. Its not enough to
                        specify 'installed' in the container tag. You have to now specify
                        another configuration with type == existing and re-issue the home
                        path
                    -->
                    <type>existing</type>
                    <home>${catalina.home}</home>
                </configuration>
                <!--
                    Cargo has the notion of a 'deployer' in which you specify
                    'deployables'
                -->
                <deployer>
                    <!-- You have to again specify that the type for the deployer -->
                    <type>installed</type>
                    <deployables>
                        <!-- This deployable specifies the webapp you want to deploy -->
                        <deployable>
                            <groupId>com.dpillay.oworld</groupId>
                            <artifactId>oworld-webapp</artifactId>
                            <type>war</type>
                        </deployable>
                    </deployables>
                </deployer>
            </configuration>
            <!--
                Executions specify the targets that you want to run during build
            -->
            <executions>
                <!--
                    Maven has the concept of a 'phase' which can be thought of a
                    collection of goals. Hence here we are specifying that during the
                    'install' phase first deploy the webapp to the container specific
                    folder and then start the container. Both 'deployer-deploy' and
                    'start' are cargo specific goals.
                -->
                <execution>
                    <id>verify-deploy</id>
                    <phase>install</phase>
                    <goals>
                        <goal>deployer-deploy</goal>
                        <goal>start</goal>
                    </goals>
                </execution>
                <!--
                    Specifying that during the 'pre-clean' phase, Cargo should first
                    stop the container.
                -->
                <execution>
                    <id>clean-undeploy</id>
                    <phase>pre-clean</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
于 2012-12-19T11:24:52.720 に答える