具有多个构建(配置文件)的模块的ivy存储库结构?

发布于 2025-01-03 20:04:28 字数 942 浏览 3 评论 0 原文

我在 .NET 商店中使用 Ant 和 Ivy 进行依赖管理,并取得了很大的成功,但我无法找到解决此问题的方法。我的问题涉及具有多个不同配置文件的模块的存储库结构(由于缺乏 更好的术语)。例如,我尝试在存储库中设置的模块(它是第 3 方库 - Castle)已针对不同版本的 .NET 平台进行编译。该发行版具有以下目录结构:

  • net35/Castle.Core.dll
  • net40clientprofile/Castle.Core.dll
  • sl3/Castle.Core.dll
  • sl4/Castle.Core.dll

我的 ivysettings.xml 文件的文件解析器设置如下

<filesystem name="fs.resolver" cache="nn.repo.cache">
    <ivy pattern="${repository.dir}/[organisation]/[module]/[shortRevision]/[revision]/ivy.xml" />
    <artifact pattern="${repository.dir}/[organisation]/[module]/[shortRevision]/[revision]/[artifact].[ext]" />
</filesystem>

:首先,我认为配置可以用于此目的,但没有 取得很大进展。如何在 Ivy.xml 文件中多次指定同名的工件?我认为你不能。另外,如果我在存储库中添加子目录,我会 必须修改 ivysettings.xml 中的工件模式吗?

Ivy 设置此模块的推荐方法是什么? 该模块的 Ivy.xml 文件是什么样的?将如何 ivysettings.xml 文件需要为此修改吗?

希望我不必为同一版本库的每个不同编译创建单独的模块。

预先感谢您的任何帮助。

I'm using Ant and Ivy for dependency management in a .NET shop and have been having a lot of success, but I can't figure out a solution for this issue. My question pertains to the repository structure for modules that have several different profiles (for lack of
a better term). For example, the module (it's a 3rd party library - Castle) I'm trying to setup in the repository has been compiled against different versions of the .NET platform. This distribution has the following directory structure:

  • net35/Castle.Core.dll
  • net40clientprofile/Castle.Core.dll
  • sl3/Castle.Core.dll
  • sl4/Castle.Core.dll

My ivysettings.xml file has the File Resolver setup as this:

<filesystem name="fs.resolver" cache="nn.repo.cache">
    <ivy pattern="${repository.dir}/[organisation]/[module]/[shortRevision]/[revision]/ivy.xml" />
    <artifact pattern="${repository.dir}/[organisation]/[module]/[shortRevision]/[revision]/[artifact].[ext]" />
</filesystem>

At first, I thought configurations could be used for this, but didn't
make much progress. How can I specify an artifact in the Ivy.xml file with the same name more than once? I don't think you can. Also, if I add subdirectories in the repository will I
have to modify my artifact pattern in ivysettings.xml?

What is the recommended approach with Ivy to setting this module up?
What would the Ivy.xml file for this module look like? How would the
ivysettings.xml file need to be modified for this?

Hopefully I don't have to create separate modules for each different compilation of the same version of the library.

Thanks in advance for any help.

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

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

发布评论

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

评论(1

油焖大侠 2025-01-10 20:04:28

在ivy中,您可以向模块工件添加额外属性

项目设置:

|-- build.xml
|-- ivysettings.xml
|-- ivy.xml
`-- repository
    `-- myorg
        `-- Castle
            `-- 1.0
                |-- ivy.xml
                |-- net35
                |   `-- Castle.Core.dll
                |-- net40clientprofile
                |   `-- Castle.Core.dll
                |-- sl3
                |   `-- Castle.Core.dll
                `-- sl4
                    `-- Castle.Core.dll

ivy.xml

使用配置映射来选择要下载的工件:

 <ivy-module version="2.0">
    <info organisation="org.demo" module="demo"/>
    <dependencies>
        <dependency org="myorg" name="Castle" rev="1.0" conf="default->net35"/>
    </dependencies>
</ivy-module>

ivysettings.xml

工件模式包括 名为“profile”的额外属性

<ivysettings>
    <settings defaultResolver="local"/>
    <resolvers>
        <filesystem name="local">
            <ivy pattern="${ivy.settings.dir}/repository/[organisation]/[module]/[revision]/ivy.xml" />
            <artifact pattern="${ivy.settings.dir}/repository/[organisation]/[module]/[revision]/[profile]/[artifact].[ext]" />
        </filesystem>
    </resolvers>
</ivysettings>

repository/myorg/Castle/1.0/ivy.xml强>

额外属性 “profile”用于区分模块内的工件。这些配置用于启用客户端模块的配置映射。

<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info organisation="myorg" module="Castle" revision="1.0" status="release"/>
    <configurations>
        <conf name="net35"/>
        <conf name="net40clientprofile"/>
        <conf name="sl3"/>
        <conf name="sl4"/>
    </configurations>
    <publications>
        <artifact name="Castle.Core" type="dll" e:profile="net35" conf="net35"/>
        <artifact name="Castle.Core" type="dll" e:profile="net40clientprofile" conf="net40clientprofile"/>
        <artifact name="Castle.Core" type="dll" e:profile="sl3" conf="sl3"/>
        <artifact name="Castle.Core" type="dll" e:profile="sl4" conf="sl4"/>
    </publications>
</ivy-module>

In ivy you can add extra attributes to module artifacts.

Project setup:

|-- build.xml
|-- ivysettings.xml
|-- ivy.xml
`-- repository
    `-- myorg
        `-- Castle
            `-- 1.0
                |-- ivy.xml
                |-- net35
                |   `-- Castle.Core.dll
                |-- net40clientprofile
                |   `-- Castle.Core.dll
                |-- sl3
                |   `-- Castle.Core.dll
                `-- sl4
                    `-- Castle.Core.dll

ivy.xml

Use a configuration mapping to choose which artifact to download:

 <ivy-module version="2.0">
    <info organisation="org.demo" module="demo"/>
    <dependencies>
        <dependency org="myorg" name="Castle" rev="1.0" conf="default->net35"/>
    </dependencies>
</ivy-module>

ivysettings.xml

The artifact pattern includes an extra attribute called "profile"

<ivysettings>
    <settings defaultResolver="local"/>
    <resolvers>
        <filesystem name="local">
            <ivy pattern="${ivy.settings.dir}/repository/[organisation]/[module]/[revision]/ivy.xml" />
            <artifact pattern="${ivy.settings.dir}/repository/[organisation]/[module]/[revision]/[profile]/[artifact].[ext]" />
        </filesystem>
    </resolvers>
</ivysettings>

repository/myorg/Castle/1.0/ivy.xml

The extra attribute "profile" is used to differentiate between the artifacts within the module. The configurations are used to enable configuration mapping by client modules.

<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info organisation="myorg" module="Castle" revision="1.0" status="release"/>
    <configurations>
        <conf name="net35"/>
        <conf name="net40clientprofile"/>
        <conf name="sl3"/>
        <conf name="sl4"/>
    </configurations>
    <publications>
        <artifact name="Castle.Core" type="dll" e:profile="net35" conf="net35"/>
        <artifact name="Castle.Core" type="dll" e:profile="net40clientprofile" conf="net40clientprofile"/>
        <artifact name="Castle.Core" type="dll" e:profile="sl3" conf="sl3"/>
        <artifact name="Castle.Core" type="dll" e:profile="sl4" conf="sl4"/>
    </publications>
</ivy-module>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文