8

我有几个 jar 文件(其中一些相互依赖),我正试图让常春藤为我的项目管理它们。

我不想创建一个“本地”(基于用户目录的)存储库,因为我希望其他用户能够检查我的 svn 项目并在没有本地/共享存储库设置的情况下运行它。由于各种原因,我无法将这些文件添加到我们正在使用的实际存储库中。

该项目依赖于这些文件,我在 SVN 中使用它们。过去,我有正常的 ivy 依赖 xml 文件。这些文件使用一个设置 xml 文件指向远程存储库。过去,在最后一刻,我让 ant 使用构建任务将这些文件从 lib 文件夹复制到构建文件夹中。这感觉像是一种破坏性的滥用,它忽略了 ivy 文件系统解析器的功能。

(用于 3 个可构建项目的 ivy.xml 和 build.xml 在另一个基本目录中使用相同的 ivysettings.xml。)

我觉得我已经完成了 90% 的工作,我应该在 ivysettings.xml 中将我的文件系统解析器指向什么,以便在解析器链中首次解析 projectdir/lib 中的 jar 文件?

4

1 回答 1

3

Have you looked at the ivy task buildlist?

You could use this to control the order in which your 3 modules are built. As each module is built it can publish to a local repository, ensuring that the jar is present in time for the next module in the chain.

   build.xml
   ivysettings.xml
   --> module1 --> build.xml
                   ivy.xml
   --> module2 --> build.xml
                   ivy.xml
   --> module3 --> build.xml
                   ivy.xml

You settings file can be shared by all projects. It states that the modules you build are available locally, everything else is from the default repository available to all users of your project (In this case Maven)

<ivysettings>
        <settings defaultResolver="maven2"/>
        <resolvers>
                <ibiblio name="maven2" m2compatible="true"/>

                <filesystem name="local">
                    <ivy pattern="${local.rep.dir}/.."/>
                    <artifact pattern="${local.rep.dir}/.."/>
                </filesystem>
        </resolvers>
        <modules>
                <module organisation="org.me" name="module1" resolver="local"/>
                <module organisation="org.me" name="module2" resolver="local"/>
                ..
        </modules>
</ivysettings>

Finally when you publish externally you can use the ivy install task to copy the modules you've already published locally into the final repository location

于 2010-02-07T14:18:19.560 回答