我想使用 hudson 创建一个战争文件。我做了以下步骤。
1.我在我的项目中创建了 build.xml。
2.在那个 ant 文件中,我提供了编译应用程序和创建战争的目标。
3.然后我创建了 hudson 作业,我在其中提供构建选项,即由 ant 调用。在部署选项中,我提供了 weContainer,我必须在其中部署战争。
4.它创造了战争并将其部署在网络容器上。
但这是正确的做法吗?
谢谢,
我想使用 hudson 创建一个战争文件。我做了以下步骤。
1.我在我的项目中创建了 build.xml。
2.在那个 ant 文件中,我提供了编译应用程序和创建战争的目标。
3.然后我创建了 hudson 作业,我在其中提供构建选项,即由 ant 调用。在部署选项中,我提供了 weContainer,我必须在其中部署战争。
4.它创造了战争并将其部署在网络容器上。
但这是正确的做法吗?
谢谢,
您可以使用 maven cargo 插件和复制工件插件来使用 hudson 部署战争。提供您的服务器管理员。在 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>