问题
Maven repositories, like Maven Repository offer the widest range of projects for dependency management.
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.
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:
- which scopes are available by default and what artifacts will they offer
- How is a maven scoped mapped to an ivy conf / configuration?
回答1:
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
Oddly, I never really understood ivy configurations, until it was explained how they can be used to simulate Maven scopes.
The following listis from the www.symphonious.net link and illustrates the available configurations from pom-files/maven repositories:
- 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
来源:https://stackoverflow.com/questions/7104364/how-are-maven-scopes-mapped-to-ivy-configurations-by-ivy