我有一个项目依赖于另一个项目中的一些其他 Java 类。在 Eclipse 中,这两个项目正在运行,没有任何错误。
现在我想用 Jenkins 和 Ant 构建具有依赖关系的项目。
我使用此配置从 Ivy 获得依赖项:
<publications>
<artifact name="${version.name}" type="war" ext="war"/>
</publications>
<dependencies>
<dependency org="de.company.sh" name="rest-db" rev="latest.integration"/>
</dependencies>
build.xml 中的检索:
<!-- retrieve dependencies from ivy -->
<target name="retrieve" depends="prepare, prepare.productive, prepare.beta">
<!-- Fetch parameters from properties -->
<property file="build.properties" />
<!-- Resolve module -->
<ivy:resolve file="ivy.xml" />
<!-- Retrieve dependencies -->
<ivy:retrieve pattern="${build}/deps/[organization]/[module]/[artifact]-[revision].[ext]" />
</target>
Jenkins 的控制台日志:
[ivy:resolve] Apr 24, 2013 1:42:06 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
[ivy:resolve] INFO: Basic authentication scheme selected
[ivy:resolve] downloading http://localhost:7080/nexus/content/repositories/snapshots/de/company/sh/rest-db/1.0.3269/wars/rest-db-1.0.3269.war ...
到目前为止一切正常
但是现在我有一个问题,我不能从 war 文件中包含类文件。从war文件到相关类文件的文件夹结构:rest-db-1.0.3269.war\WEB-INF\classes\de\company\sh...
这是我的尝试,但没有成功:-(
<!-- create war file from java classes -->
<target name="war" depends="compile">
<!-- Move rest-db where it is needed
<war destfile="${build}/lib/rest-db.war" webxml="WEB-INF/web.xml">
<zipfileset dir="${build}/classes" includes="**/*.class"/>
</war>
-->
<!-- -->
<zip destfile="${build}/deps/de.company.sh/rest-db" basedir="${build}" update="true" />
<!-- Copy all necessary Spring libraries -->
<copy todir="${build}/lib">
<!-- All files directly located in the lib/ directory -->
<fileset dir="${lib}">
<include name="*.jar" />
</fileset>
</copy>
...
<!-- Move rest-db where it is needed
<copy todir="${build}/classes">
<fileset dir="${build}/deps/de.company.sh/rest-db">
<include name="*.*" />
</fileset>
</copy>
-->
我希望你对我有一些绝妙的建议:-)