Ant构建:从类文件夹中的Ivy依赖项war文件中提取类文件

时间:2013-04-24 12:17:26

标签: ant jenkins build-process ivy

我有一个项目,它依赖于来自另一个项目的其他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文件到相关类文件的文件夹结构: 其余-DB-1.0.3269.war \ WEB-INF \类\德\公司\ 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>
     -->

我希望你能为我提出一些很好的建议: - )

1 个答案:

答案 0 :(得分:0)

听起来你正试图在已经使用常春藤下载的工件内声明对工件的依赖?

也许打包机解析器是你需要看的地方。功能强大虽然设置有点复杂。

有关示例,请参阅:

相关问题