常春藤简单共享存储库 [英] ivy simple shared repository

查看:93
本文介绍了常春藤简单共享存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将公司中一个大项目的所有子项目编译成具有托管依赖项的多个jar,以便并非每个从事一个项目的人都需要从共享存储库下载最新的jar。

I am trying to compile all sub projects of one big project at my company into many jars with managed dependencies, so that not everybody who works at one project only needs to download the latest jars from a shared repository.

ivy似乎是解决我们问题的方法,因为ivy表示它与ant(外部构建系统)的集成非常好。但是我听不懂这些教程,它们在某种程度上比令人困惑的有用,而不是有用的。

ivy seems to be the solution for our problem, because ivy says that it integrates with ant (out build system) very well. But I cant get through the tutorials, they are all somehow more confusing than helpful.

我一开始要实现的目标是拥有两个小型项目。第一个具有一个带有一个方法的类,第二个仅调用此方法。第一个项目应编译成一个jar,然后由第二个项目从共享存储库下载。

All I want to achieve for the beginning is to have two small Projects. The first one has one class with one method, the second one is just calling this method. The fist project should compile into a jar that is then downloaded by the second project from the shared repository.

感谢您的帮助。

推荐答案

文档中描述了一个多模块项目:

A multi-module project is described in the documentation:

http://ant.apache.org/ivy/history/latest-milestone/tutorial/multiproject.html

,并且源代码可在Subversion中使用:

and the source code is available in subversion:

http://svn.apache.org/viewvc/ant/ivy/core / trunk / src / example / multi-project /

其工作原理的简化摘要:

The simplified summary of how it works:

以正确的顺序调用每个模块。如果模块A依赖于模块B,则将首先构建B:

Invokes each individual module build in the correct order. If Module A depends on module B, then B will be built first:

<project xmlns:ivy="antlib:org.apache.ivy.ant" name="build-all" default="build">

    <!--
    ==========================================================================
    Use the ivy buildlist task to create an ordered list of sub-project builds
    ==========================================================================
    -->
    <target name="build-list">
        <ivy:buildlist reference="build-path">
            <fileset dir="." includes="modules/**/build.xml"/>
        </ivy:buildlist>
    </target>

    <!--
    ==============================
    Invoke targets in sub-projects
    ==============================
    -->
    <target name="build" depends="build-list" description="Invoke build target on sub-projects">
        <subant target="build" buildpathref="build-path" />
    </target>

</project>

有关更多信息,请参见构建列表文档。

For more information see the buildlist documentation.

每个模块将在构建开始时下载其依赖项

Each module will download it's dependencies at the beginning of it's build

<target name="init">
    <ivy:settings file="../../ivysettings.xml"/>
    <ivy:resolve/>
</target>

最后,将发布其构建的工件:

At at the end, will publish it's built artifacts:

<target name="publish" depends="build" description="Publish module artifacts to the respository">
    <ivy:publish resolver="${publish.resolver}" pubrevision="${publish.revision}" overwrite="true">
        <artifacts pattern="${build.dir}/[artifact].[ext]"/>
    </ivy:publish>
</target>

不要忘记,所有这些工作都必须声明它依赖于什么以及它依赖什么发布

Don't forget that for all this to work each module must declare what it depends on and what it publishes

<ivy-module version='2.0'>

    <info organisation='com.myorg' module='mymod'/>

    <publications>
        <artifact name="mymod" type="jar"/>
    </publications>

    <dependencies>
         ..
    </dependencies>

</ivy-module>

这篇关于常春藤简单共享存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆