<configurations>
<conf name="default" description="runtime dependencies and master artifact can be used with this conf" />
<conf name="master"
description="contains only the artifact published by this module itself, with no transitive dependencies. E.g. The projects jar itself" />
<conf name="compile"
description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths. E.g. commons-lang" />
<conf name="provided"
description="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. E.g. Servlet APIs" />
<conf name="runtime"
description="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. E.g. An AOP runtime library" />
<conf name="test" extends="compile"
description="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. E.g. JUnit" />
<conf name="system"
description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository. E.g. ??" />
<conf name="sources" description="this configuration contains the source artifact of this module, if any. E.g. Source for the project" />
<conf name="javadoc" description="this configuration contains the javadoc artifact of this module, if any. E.g. JavaDoc for the project" />
<conf name="optional" description="contains all optional dependencies. E.g. Anything optional" />
<conf name="javascript" description="JS dependencies" />
</configurations>
<dependencies>
<!-- commons deps -->
<dependency org="org.apache.commons" name="commons-lang3" rev="3.1" conf="compile->default" />
<dependency org="commons-io" name="commons-io" rev="2.4" conf="compile->default" />
<dependency org="commons-collections" name="commons-collections" rev="]3.2,4.0[" conf="compile->default" />
<dependency org="commons-fileupload" name="commons-fileupload" rev="1.3" conf="compile->default" />
</dependencies>
我的ANT文件类似于:
<project name="core-utils" default="default" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib">
<description>
core-utils tasks
</description>
<!-- ant creates for every build file a property named ant.file.${ant.project.name}, e.g. ant.file.common-paths -->
<dirname property="basedir.core-utils" file="${ant.file.core-utils}" />
<!-- workspace directory -->
<property name="dir.workspace" location="${basedir.core-utils}/../" />
<!-- import the needed files -->
<import file="${dir.workspace}/dev-environment/build-common-paths.xml" />
<import file="${dir.workspace}/dev-environment/build-common-antExtensions.xml" />
<antcontrib:var name="dir.current.project" value="${basedir.core-utils}" />
<antcontrib:var name="file.ivy.xml" value="${dir.current.project}/ivy.xml"/>
<!-- =================================
target: default
================================= -->
<target name="default" depends="init, compile" description="Default target for this project">
</target>
<!-- - - - - - - - - - - - - - - - - -
target: init
- - - - - - - - - - - - - - - - - -->
<target name="init">
<echo>dir.workspace=${dir.workspace}</echo>
<echo>processing ANT project ${ant.project.name}</echo>
<echo>dir.current.project=${dir.current.project}</echo>
<echo>file.ivy.xml=${file.ivy.xml}</echo>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: resolve
- - - - - - - - - - - - - - - - - -->
<target name="resolve">
<ivy:resolve file="${file.ivy.xml}" checkifchanged="true" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: retrieve
- - - - - - - - - - - - - - - - - -->
<target name="retrieve" depends="resolve">
<retrieve ivyConfigs="compile" projectRootDir="${dir.current.project}" projectBuildType="${build.artefact.type}" projectParentEarRootDir="${dir.prj.java.my-ear}" />
</target>
<!-- =================================
target: ivy-default
================================= -->
<target name="ivy-default" depends="init-common-antExtensions" description="IVY default target for this project">
<!-- the resulting artefact type, could be WAR, EAR, UTILJAR, RUNTIME -->
<property name="build.artefact.type" value="UTILJAR" />
<checkIvyInitialized projectrootdir="${dir.current.project}" />
<ivy:settings file="${dir.prj.common.devenv}/ivysettings.xml" />
<antcall target="retrieve" inheritall="true" inheritrefs="true" />
</target>
<!-- =================================
target: compile
================================= -->
<target name="compile" depends="ivy-default" description="compile the project">
<ivy:resolve conf="compile,test" file="${file.ivy.xml}" checkifchanged="true" refresh="true"/>
<!-- folder is missing -->
<mkdir dir="${dir.current.project}/target/ivy" />
<mkdir dir="${dir.current.project}/target/ivy/compile" />
<ivy:retrieve conf="compile" refresh="true" file="${file.ivy.xml}" pattern="${dir.current.project}/target/compile/[artifact]-[revision].[ext]" sync="false" overwriteMode="always" />
<mkdir dir="${dir.current.project}/target/ivy/test" />
<ivy:retrieve conf="test" file="${file.ivy.xml}" pattern="${dir.current.project}/target/ivy/test/[artifact]-[revision].[ext]" sync="false" overwriteMode="always" />
<mkdir dir="${dir.current.project}/target/classes" />
<javac srcdir="${dir.current.project}/src/main/java" destdir="${dir.current.project}/target/classes" debug="on" compiler="javac1.7" source="1.7" target="1.7" fork="true" includeantruntime="no">
<classpath>
<fileset dir="${dir.current.project}/target/ivy/compile">
<include name="*" />
</fileset>
</classpath>
</javac>
<mkdir dir="${dir.current.project}/target/test-classes" />
<javac srcdir="${dir.current.project}/src/test/java" destdir="${dir.current.project}/target/test-classes" debug="on" compiler="javac1.7" source="1.7" target="1.7" fork="true" includeantruntime="no">
<classpath>
<fileset dir="${dir.current.project}/target/ivy/test">
<include name="*" />
</fileset>
</classpath>
</javac>
</target>
</project>
IVY正确解析了工件,但复制/检索无法正常工作。我不知道出了什么问题。
compile:
[echo] file.ivy.xml=/mnt/data/00_Synchronized/XenoRealEstate/trunk/Projects/RealEstateDueDiligence/core-utils/ivy.xml
[ivy:retrieve] :: resolving dependencies :: org.xenovation#core-utils;working@ntb-dp
[ivy:retrieve] confs: [compile]
[ivy:retrieve] found org.apache.commons#commons-lang3;3.1 in central
[ivy:retrieve] found commons-io#commons-io;2.4 in central
[ivy:retrieve] found commons-collections#commons-collections;3.2.1 in central
[ivy:retrieve] [3.2.1] commons-collections#commons-collections;]3.2,4.0[
[ivy:retrieve] found commons-fileupload#commons-fileupload;1.3 in central
[ivy:retrieve] found ch.qos.logback#logback-classic;1.1.2 in central
[ivy:retrieve] [1.1.2] ch.qos.logback#logback-classic;]1.0,2.0[
[ivy:retrieve] found ch.qos.logback#logback-core;1.1.2 in central
[ivy:retrieve] found org.slf4j#slf4j-api;1.7.6 in central
[ivy:retrieve] found ch.qos.logback#logback-access;1.1.2 in central
[ivy:retrieve] [1.1.2] ch.qos.logback#logback-access;]1.0,2.0[
[ivy:retrieve] found org.apache.httpcomponents#httpclient;4.3.1 in central
[ivy:retrieve] found org.apache.httpcomponents#httpcore;4.3 in central
[ivy:retrieve] found commons-logging#commons-logging;1.1.3 in central
[ivy:retrieve] found commons-codec#commons-codec;1.6 in central
[ivy:retrieve] found org.jsefa#jsefa;0.9.3.RELEASE in central
[ivy:retrieve] found xmlpull#xmlpull;1.1.2.1 in central
[ivy:retrieve] found org.json#json;20131018 in central
[ivy:retrieve] found org.wildfly#wildfly-spec-api;8.0.0.Final in central
[ivy:retrieve] found org.glassfish#javax.json;1.0.3 in central
[ivy:retrieve] found org.jboss.resteasy#jaxrs-api;3.0.6.Final in central
[ivy:retrieve] found org.jboss.spec.javax.batch#jboss-batch-api_1.0_spec;1.0.0.Final in central
[ivy:retrieve] found javax.inject#javax.inject;1 in central
[ivy:retrieve] found javax.enterprise#cdi-api;1.1 in central
[ivy:retrieve] found javax.el#el-api;2.2 in central
[ivy:retrieve] found org.jboss.spec.javax.interceptor#jboss-interceptors-api_1.1_spec;1.0.0.Beta1 in central
[ivy:retrieve] found javax.annotation#jsr250-api;1.0 in central
[ivy:retrieve] found org.jboss.spec.javax.ejb#jboss-ejb-api_3.2_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.el#jboss-el-api_3.0_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.enterprise.concurrent#jboss-concurrency-api_1.0_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.faces#jboss-jsf-api_2.2_spec;2.2.5 in central
[ivy:retrieve] found org.jboss.spec.javax.interceptor#jboss-interceptors-api_1.2_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.jms#jboss-jms-api_2.0_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.resource#jboss-connector-api_1.7_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.security.auth.message#jboss-jaspi-api_1.1_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.security.jacc#jboss-jacc-api_1.5_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.servlet#jboss-servlet-api_3.1_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.servlet.jsp#jboss-jsp-api_2.3_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.servlet.jstl#jboss-jstl-api_1.2_spec;1.0.4.Final in central
[ivy:retrieve] found org.jboss.spec.javax.transaction#jboss-transaction-api_1.2_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.websocket#jboss-websocket-api_1.0_spec;1.0.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.xml.bind#jboss-jaxb-api_2.2_spec;1.0.4.Final in central
[ivy:retrieve] found org.jboss.spec.javax.xml.rpc#jboss-jaxrpc-api_1.1_spec;1.0.1.Final in central
[ivy:retrieve] found org.jboss.spec.javax.xml.soap#jboss-saaj-api_1.3_spec;1.0.3.Final in central
[ivy:retrieve] found org.jboss.spec.javax.xml.ws#jboss-jaxws-api_2.2_spec;2.0.2.Final in central
[ivy:retrieve] found org.hibernate.javax.persistence#hibernate-jpa-2.1-api;1.0.0.Final in central
[ivy:retrieve] found org.osgi#org.osgi.core;5.0.0 in central
[ivy:retrieve] found com.sun.mail#javax.mail;1.5.1 in central
[ivy:retrieve] found javax.activation#activation;1.1.1 in central
[ivy:retrieve] found org.jboss.spec.javax.annotation#jboss-annotations-api_1.2_spec;1.0.0.Final in central
[ivy:retrieve] found javax.validation#validation-api;1.1.0.Final in central
[ivy:retrieve] found org.jboss.spec.javax.management.j2ee#jboss-j2eemgmt-api_1.1_spec;1.0.1.Final in central
[ivy:retrieve] found org.wildfly#wildfly-build-config;8.0.0.Final in central
[ivy:retrieve] :: resolution report :: resolve 24549ms :: artifacts dl 82ms
[ivy:retrieve] :: evicted modules:
[ivy:retrieve] commons-io#commons-io;2.2 by [commons-io#commons-io;2.4] in [compile]
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| compile | 51 | 3 | 0 | 1 || 49 | 0 |
---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: org.xenovation#build
[ivy:retrieve] confs: [compile]
[ivy:retrieve] 0 artifacts copied, 0 already retrieved (0kB/5ms)
有人可以帮助我,并告诉我我做错了什么吗?
答案 0 :(得分:0)
不明白你的意思&#34;复制/检索工作不正常&#34;
您的设置似乎过于复杂。这是一个例子,希望它有助于澄清常春藤配置的使用: