ivy 如何将 maven 范围映射到 ivy 配置 [英] How are maven scopes mapped to ivy configurations by ivy

查看:33
本文介绍了ivy 如何将 maven 范围映射到 ivy 配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maven 存储库,例如 Maven 存储库,提供最广泛的依赖项管理项目.

Maven repositories, like Maven Repository offer the widest range of projects for dependency management.

Ivy 提供了访问 maven 存储库并从那里下载工件的可能性.这些存储库中只有 pom 文件,没有 ivy.xml.

Ivy offers the possibility to access maven repositories and download artifacts from there. There are only pom files in those repositories and no ivy.xml.

可以使用在 m2compatible 中运行的 ivy 解析器检索它们模式.

They can be retrieved with an ivy resolver that runs in m2compatible mode.

<ibiblio name="maven2" m2compatible="true"/>

特别是对于这个我想知道的用例:

Especially for this Use-case I want to know:

  • 默认情况下哪些范围可用以及它们将提供哪些工件
  • maven 范围如何映射到 ivy conf/配置?

推荐答案

下面两篇文章帮助我更好地理解了 Maven 和 Ivy 如何互操作

The following two articles helped me to better understand how Maven and Ivy inter-operate

奇怪的是,我从来没有真正理解常春藤配置,直到解释了如何使用它们来模拟 Maven 范围.

Oddly, I never really understood ivy configurations, until it was explained how they can be used to simulate Maven scopes.

以下列表来自 www.symphonious.net 链接 并说明了 pom-files/maven 存储库中的可用配置:

The following listis from the www.symphonious.net link and illustrates the available configurations from pom-files/maven repositories:

  • 默认 运行时依赖项和主工件可与这个配置
  • ma​​ster 仅包含此模块本身发布的工件,没有传递依赖
  • compile 这是默认范围,如果没有指定则使用.编译依赖在所有类路径中都可用
  • 提供这很像编译,但表明您期望使用 JDK或提供它的容器.它仅在编译类路径上可用,不可传递
  • runtime 这个范围表示不需要依赖编译,但用于执行.它在运行时和测试中类路径,但不是编译类路径
  • test 这个范围表示不需要依赖应用程序正常使用,仅供测试使用编译和执行阶段
  • system 此范围类似于提供的范围,但您必须提供明确包含它的 JAR.
  • sources 此配置包含此配置的源工件模块,如果有项目的来源
  • javadoc 此配置包含此配置的 javadoc 工件模块,如果有项目的 JavaDoc
  • optional 包含所有可选的依赖项
  • default runtime dependencies and master artifact can be used with this conf
  • master contains only the artifact published by this module itself, with no transitive dependencies
  • compile this is the default scope, used if none is specified. Compile dependencies are available in all classpaths
  • provided this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive
  • runtime this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath
  • test this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases
  • system this scope is similar to provided except that you have to provide the JAR which contains it explicitly.
  • sources this configuration contains the source artifact of this module, if any Source for the project
  • javadoc this configuration contains the javadoc artifact of this module, if any JavaDoc for the project
  • optional contains all optional dependencies

这篇关于ivy 如何将 maven 范围映射到 ivy 配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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