如何阻止 Ivy 解析的状态

发布于 2024-09-10 17:56:26 字数 240 浏览 3 评论 0原文

在我们公司,我们使用每个人都包含的基本 Ant 文件来进行构建。它包含我们想要全局和统一定义的内容,例如构建测试、测试覆盖、构建发布、在ivy上发布等。

我想在为创建发布版本而完成的ivy解析中强制执行这一点,具有测试(集成)状态的库将被拒绝。基本上,对于发布版本,您只能使用发布类库。

但是,我找不到在 ivy 解析 ant 任务中强制执行此操作的方法(不在 ivy.xml 文件中)。

有人知道如何实现这一目标吗?

At our company, we use a base ant file that is included by everyone to do their builds. It contains the things we want to define globally and uniform, like build-test, test-coverage, build-release, publish on ivy, etc.

I would like to enforce that in the ivy resolve that is done for creating a release build, libraries that have test (integration) status are rejected. Basically, that for a release build, you can only use release-class libraries.

However, I cannot find a way to enforce this in the ivy resolve ant task (not in the ivy.xml file).

Does anybody have an idea on how to accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我不会写诗 2024-09-17 17:56:27

选项 1

严格来说,您有两组已解析的库,因此可以通过两个 ivy 文件来解决这个问题。一个列出了对最新集成修订版的依赖关系,另一个列出了最新发布版本的依赖关系。

然后,build.xml 文件将有两个解析目标,由发布属性控制

<target name="resolve-int" unless="release.build">
    <ivy:resolve file="ivy-int.xml"/>
</target>

<target name="resolve-rel" if="release.build">
    <ivy:resolve file="ivy-rel.xml"/>
</target>

<target name="resolve" depends="resolve-int,resolve-rel"/>

选项 2

使用属性来确定所需的动态版本:

ivy.xml

<ivy-module version="2.0">
    <info organisation="com.myspotontheweb" module="demo"/>
    <dependencies>
        <dependency org="commons-lang" name="commons-lang" rev="${dynamic.revision}"/>
    </dependencies>
</ivy-module>

build.xml

属性dynamic.revision有一个默认值latest.integration

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

    <property name="dynamic.revision" value="latest.integration"/>

    <target name="resolve">
        <ivy:resolve/>
    </target>

    ..    

</project>

然后发布版本将覆盖该值,可能从命令行,如下所示:

ant -Ddynamic.revision=latest.release

Option 1

Strictly speaking you have two sets of resolved libraries, so this could be solved by having two ivy files. One listing dependencies on the latest integration revisions the other the latest release versions.

The build.xml file would then have two resolution targets, controlled by a release property

<target name="resolve-int" unless="release.build">
    <ivy:resolve file="ivy-int.xml"/>
</target>

<target name="resolve-rel" if="release.build">
    <ivy:resolve file="ivy-rel.xml"/>
</target>

<target name="resolve" depends="resolve-int,resolve-rel"/>

Option 2

Use a property to determine the desired dynamic revision:

ivy.xml

<ivy-module version="2.0">
    <info organisation="com.myspotontheweb" module="demo"/>
    <dependencies>
        <dependency org="commons-lang" name="commons-lang" rev="${dynamic.revision}"/>
    </dependencies>
</ivy-module>

build.xml

The property dynamic.revision has a default value of latest.integration

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

    <property name="dynamic.revision" value="latest.integration"/>

    <target name="resolve">
        <ivy:resolve/>
    </target>

    ..    

</project>

A release build would then override this value, possibly from the command-line as follows:

ant -Ddynamic.revision=latest.release
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文