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

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

问题描述

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.

可以使用与m2兼容的 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

  • http://www.symphonious.net/2010/01/25/using-ivy-for-dependency-management/
  • http://lightguard-jp.blogspot.com/2009/04/ivy-configurations-when-pulling-from.html

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

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

以下列表来自 www.symphonious.网络链接,并说明了pom文件/maven存储库中的可用配置:

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

  • 默认运行时依赖项和主工件可以与 这个会议
  • 母版仅包含此模块本身发布的工件, 没有传递依赖
  • 编译,这是默认范围,如果未指定则使用. 编译依赖项在所有类路径中均可用
  • 提供,这很像编译,但是表明您期望使用JDK 或提供它的容器.它仅在编译类路径上可用,并且不可传递
  • 运行时,该范围表明不需要依赖关系 编译,但用于执行.它在运行时进行测试 类路径,但不是编译类路径
  • 测试,该范围表明该依赖关系不是必需的 正常使用该应用程序,并且仅可用于测试 编译和执行阶段
  • 系统:此范围类似于所提供的范围,只不过您必须 提供明确包含它的JAR.
  • 来源,此配置包含此来源的工件 模块,如果有项目源的话
  • javadoc ,此配置包含此Javadoc工件 模块,如果有该项目的JavaDoc
  • 可选包含所有可选依赖项
  • 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

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

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