resolving javadoc files with Ant and Ivy - ant

I'd like Ivy to fetch both the log4j .jar and JavaDocs. Right now, I am at a dead end. When If I use this in my ivy.xml ...
<dependency org="log4j" name="log4j" rev="1.2.16"/>
... then I just get the .jar file. But when using this ivysettings.xml ...
<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
<settings
defaultResolver="default"
defaultConflictManager="all" />
<resolvers>
<url name="default" m2compatible="true">
<artifact pattern="http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
<artifact pattern="http://repo2.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</url>
</resolvers>
</ivysettings>
... and this ivy.xml ...
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="foo" module="bar"/>
<dependencies>
<dependency org="log4j" name="log4j" rev="1.2.16">
<artifact name="log4j" type="jar" ext="jar"/>
<artifact name="log4j" type="javadoc" ext="jar"/>
</dependency>
</dependencies>
</ivy-module>
... then I get this error message:
java.lang.RuntimeException: Multiple artifacts of the module log4j#log4j;1.2.16 are retrieved to the same file! Update the retrieve pattern to fix this error.
What I am missing here? How can I get Ivy to resolve both the JavaDoc and the .jar files?
edit:
Thanks for all the fast and detailed responses so far. This is my updated ivy.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="foo" module="bar"/>
<configurations>
<conf name="default" visibility="public"/>
<conf name="compile" visibility="public"/>
<conf name="master" visibility="public"/>
<conf name="javadoc" visibility="public"/>
</configurations>
<dependencies>
<dependency org="log4j" name="log4j" rev="1.2.16" conf="default->master,javadoc"/>
<dependency org="javax.servlet" name="servlet-api" rev="2.5" />
<dependency org="com.someother" name="proprietary-core" rev="1.2.3" force="true"/>
<dependency org="com.someother" name="proprietary" rev="1.2.3" force="true"/>
<dependency org="com.someother" name="scanner" rev="1.0" force="true"/>
</dependencies>
</ivy-module>
Now I get this error message:
Buildfile: D:\workspace\foobar\build.xml
resolve:
[ivy:retrieve] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: file = D:\workspace\foobar\ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: foo#bar;working#myhost
[ivy:retrieve] confs: [default, compile, master, javadoc]
[ivy:retrieve] found log4j#log4j;1.2.16 in internal
[ivy:retrieve] found javax.servlet#servlet-api;2.5 in internal
[ivy:retrieve] found com.someother#proprietary-core;1.2.3 in internal
[ivy:retrieve] found com.someother#proprietary;1.2.3 in internal
[ivy:retrieve] found com.someother#scanner;1.0 in internal
[ivy:retrieve] :: resolution report :: resolve 332ms :: artifacts dl 10ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 5 | 0 | 0 | 0 || 4 | 0 |
| compile | 4 | 0 | 0 | 0 || 4 | 0 |
| master | 4 | 0 | 0 | 0 || 4 | 0 |
| javadoc | 4 | 0 | 0 | 0 || 4 | 0 |
---------------------------------------------------------------------
[ivy:retrieve]
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: UNRESOLVED DEPENDENCIES ::
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: log4j#log4j;1.2.16: configuration not found in log4j#log4j;1.2.16: 'master'. It was required from foo#bar;working#myhost default
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]
[ivy:retrieve]
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
There seems to be a problem with the Maven scopes. But what exactly am I missing here?

The problem is the pattern you are using in the ivy retrieve task. It needs to include the optional "classifier" attribute to ensure the file name is unique:
<ivy:retrieve pattern="lib/[conf]/[artifact](-[classifier]).[ext]"/>
Classifier is a Maven thing, is used to identify additional artefacts associated with a Maven module.
Additional observation
No need for complicated ivy settings. Configuration mappings control which artefacts are downloaded from other modules.
Remove the ivysettings.xml file and try the following in your ivy.xml:
<dependency org="log4j" name="log4j" rev="1.2.16" conf="default->master,javadoc"/>
This results in the following files being downloaded:
log4j-1.2.16.jar
log4j-1.2.16-javadoc.jar
How does it work?
For Maven modules ivy creates a configuration matching each of the standard Maven scopes:
master : Main jar only
compile : main jar, plus jars used for compile (This is also the "default" scope)
runtime : Main jar, plus jars used for compile, runtime
test : Main jar, plus jars used for compile, runtime, test
and additionally creates a configuration for each additional artefact (or classifier) published by the module:
sources
javadoc
This enables you to mix and match.

Related

ivy retrieve leads to "module not found: org.slf4j#slf4j-api;${slf4j.version}"

My question is, why am I able to pull dependencies from some, but not all, of the public ivy repos?
I am using an ant build.xml script to call the ivy:retrieve command. Here is the relevant line from my ivy.xml file, where I have removed all of the other dependencies for clarity:
<dependencies>
<dependency org="log4j" name="log4j" rev="1.2.16"/>
</dependencies>
which is being pulled from a public repository given in my ivysettings.xml file
<!-- General public repository !-->
<ibiblio name="public" m2compatible="true"/>
It manages to pull in some of the dependencies, so I know it's accessing the ibiblio repos correctly. However the build fails with the following error:
[ivy:retrieve]
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve] module not found: org.slf4j#slf4j-api;${slf4j.version}
[ivy:retrieve] ==== public: tried
[ivy:retrieve] http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.pom
[ivy:retrieve] -- artifact org.slf4j#slf4j-api;${slf4j.version}!slf4j-api.jar:
[ivy:retrieve] http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: UNRESOLVED DEPENDENCIES ::
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: org.slf4j#slf4j-api;${slf4j.version}: not found
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
for some reason it cannot grab the jar dependency for slf4j. Why is this happening? If it helps, I've had a coworker run the same build.xml file using the same version of ant and ivy on their workstation, and the build is successful for them. I can provide more info about our dev environments if necessary.
If you take a look closely to console output you will see that in line:
[ivy:retrieve] ==== public: tried
[ivy:retrieve] http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.pom
[ivy:retrieve] -- artifact org.slf4j#slf4j-api;${slf4j.version}!slf4j-api.jar:
[ivy:retrieve] http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: UNRESOLVED DEPENDENCIES ::
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: org.slf4j#slf4j-api;${slf4j.version}: not found
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
you trying to resolve resource located at:
[ivy:retrieve] http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.pom
and ${slf4j.version} - is a variable that was not instantiated for some reason. May be missed build.properties/ivy.properties, or this variable should be defined directly in build.xml/ivy.settings/ivysettings.xml/whatever_file_define_resolve_variables.xml.
But since it was not defined ivy trying to get resource located at exactly
http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.pom
instead of something like
http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.9/slf4j-api-1.7.9.pom
So to get resolve running you should define variable called 'slf4j.version' some way. Try to search how to define variables for ivy or for ant. There is different ways to do that.
Cannot reproduce your problem.
Example
├── build.xml
├── ivysettings.xml
├── ivy.xml
└── lib
├── activation-1.1.jar
├── geronimo-jms_1.1_spec-1.0.jar
├── log4j-1.2.16.jar
├── log4j-1.2.16-javadoc.jar
├── log4j-1.2.16-sources.jar
└── mail-1.4.1.jar
build.xml
<project name="demo" default="build" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="build">
<ivy:retrieve pattern="lib/[artifact]-[revision](-[classifier]).[ext]"/>
</target>
<target name="clean">
<delete dir="lib"/>
<ivy:cleancache/>
</target>
</project>
ivy.xml
<ivy-module version="2.0">
<info organisation="com.myspotontheweb" module="demo"/>
<dependencies>
<dependency org="log4j" name="log4j" rev="1.2.16"/>
</dependencies>
</ivy-module>
ivysettings.xml
<ivysettings>
<settings defaultResolver="central" />
<resolvers>
<ibiblio name="central" m2compatible="true"/>
</resolvers>
</ivysettings>

How to add dependency to Ant project

I would like to add dependency to my Ant project; for example I want to add hibernate dependency to my project.
I'm new to Ant. Before I used maven tool to build project.
in maven it is very easy to add dependency to pom.xml file.
My build.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project name="Demo ANT Project-1" default="run">
<target name="run" depends="compile">
<java classname="com.company.product.RoundTest">
<classpath path="staging"/>
</java>
</target>
<target name="compile">
<javac includeantruntime="false" srcdir="./src" destdir="staging" />
</target>
</project>
I want to add dependency to above Ant xml file.
PLEASE NOTE: This question was asked and answered newly 6 years ago.
First of all Ant is older than Maven and therefore does not include core support for dependency management.
Adding ivy
Ivy is a dependency management framework for Ant
http://ant.apache.org/ivy/
To enable it you need to do two things. First include the ivy task namespace to the top of your build file:
<project .... xmlns:ivy="antlib:org.apache.ivy.ant">
A secondly you'll need to install the ivy jar into one of the standard locations that ANT uses for it's 3rd party extensions:
$ANT_HOME/lib
$HOME/.ant/lib
I like to make my builds standalone so include a target that does this for me automatically:
<available classname="org.apache.ivy.Main" property="ivy.installed"/>
<target name="install-ivy" description="Install ivy" unless="ivy.installed">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
<fail message="Ivy has been installed. Run the build again"/>
</target>
Using ivy
This is a very extensive subject, the following is a simple example to download the hibernate jar and it's dependencies:
<target name="resolve" depends="install-ivy" description="Use ivy to resolve classpaths">
<ivy:cachepath pathid="compile.path">
<dependency org="org.hibernate" name="hibernate" rev="3.2.7.ga" conf="default">
<exclude org="javax.transaction"/>
</dependency>
</ivy:cachepath>
</target>
Produces the following output:
resolve:
[ivy:cachepath] :: Apache Ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/ ::
[ivy:cachepath] :: loading settings :: url = jar:file:/home/mark/.ant/lib/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:cachepath] :: resolving dependencies :: #;working#mark
[ivy:cachepath] confs: [default]
[ivy:cachepath] found org.hibernate#hibernate;3.2.7.ga in public
[ivy:cachepath] found net.sf.ehcache#ehcache;1.2.3 in public
[ivy:cachepath] found commons-logging#commons-logging;1.0.4 in public
[ivy:cachepath] found asm#asm-attrs;1.5.3 in public
[ivy:cachepath] found dom4j#dom4j;1.6.1 in public
[ivy:cachepath] found antlr#antlr;2.7.6 in public
[ivy:cachepath] found cglib#cglib;2.1_3 in public
[ivy:cachepath] found asm#asm;1.5.3 in public
[ivy:cachepath] found commons-collections#commons-collections;2.1.1 in public
[ivy:cachepath] :: resolution report :: resolve 373ms :: artifacts dl 10ms
[ivy:cachepath] :: evicted modules:
[ivy:cachepath] commons-collections#commons-collections;2.1 by [commons-collections#commons-collections;2.1.1] in [default]
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 10 | 0 | 0 | 1 || 9 | 0 |
---------------------------------------------------------------------
This ivy managed classpath can then be used in your javac task
<javac includeantruntime="false" srcdir="./src" destdir="staging" classpathref="compile.path"/>
Or simply put everything in one ant target ?
<target name="update-lib-dir">
<property name="ivy.install.version" value="2.4.0"/>
<property name="ivy.jar.file" value="lib-ant/ivy-${ivy.install.version}.jar"/>
<property name="lib-ivy.dir" value="lib-ivy"/>
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true" />
<taskdef resource="org/apache/ivy/ant/antlib.xml">
<classpath>
<pathelement location="${ivy.jar.file}"/>
</classpath>
</taskdef>
<!-- define your destination directory here -->
<retrieve pattern="${lib-ivy.dir}/[type]/[artifact]-[revision].[ext]" sync="true">
<!-- Add all your maven dependencies here -->
<dependency org="com.twelvemonkeys.imageio" name="imageio-jpeg" rev="3.4.2"/>
<dependency org="com.twelvemonkeys.imageio" name="imageio-tiff" rev="3.4.2"/>
</retrieve>
</target>
Note : Create your ivy library directory before. In this example, you should have at least a directory named lib-ant.
Hope it helps :o)

Getting crazy with IVY, IVY does not retrieve compile conf

hopefully someone can help me.
I have a multi-project configuration and I want to retrieve all conf="compile" dependencies in a local folder of the current project.
So my ivy.xml looks something like:
<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>
My ANT file looks something like:
<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 resolves the artifacts properly, but the copy / retrieve is not working properly. I have no clue what goes wrong.
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)
Can someone help me, and tell me what I am doing wrong?
Not clear what you mean by "copy / retrieve is not working properly"
Your setup seems overly complicated. Here's an example, hope it helps clarify ivy configuration usage:
How to avoid copying dependencies with Ivy

Why isn't Ivy downloading an artifact from our intranet repo?

I've had a prototype Ivy build working reasonably well. I just looked at it today and I'm seeing that it's finding an artifact on my intranet repo but not downloading it to the local cache or retrieving it in my local build, which causes the build to fail.
The build specifies several other dependencies, most of which are found on mavencentral, and one in another repo in the same local intranet repo that it's finding (but not downloading) the other artifact.
I've tried a few times to clear out the ivy cache and run this again, but it downloads all of the artifacts except for this particular one.
First, here is the relevant output from the build, with some minor pieces elided:
install-dependencies:
:: Apache Ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/ ::
:: loading settings :: file = <pathtoivysettingsxmlfile>
:: resolving dependencies :: com.att.ecom.poc#coherence_poc;working#<hostname> [not transitive]
confs: [default]
found com.att.ecom.poc#poc-domain-model;0.0.1-SNAPSHOT in mavenCentralSnapshots
found org.apache.commons#commons-lang3;3.1 in central
found org.springframework#spring-aop;4.0.0.RELEASE in central
found org.springframework#spring-beans;4.0.0.RELEASE in central
found org.springframework#spring-context;4.0.0.RELEASE in central
found org.springframework#spring-core;4.0.0.RELEASE in central
found org.springframework#spring-expression;4.0.0.RELEASE in central
found org.springframework#spring-web;4.0.0.RELEASE in central
found com.oracle.coherence#coherence;12.1.2-0-0 in mavenCentralThirdparty
:: resolution report :: resolve 351ms :: artifacts dl 8ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 9 | 0 | 0 | 0 || 8 | 0 |
---------------------------------------------------------------------
:: retrieving :: com.att.ecom.poc#coherence_poc
confs: [default]
0 artifacts copied, 8 already retrieved (0kB/5ms)
The repositories "mavenCentralSnapshots" and "mavenCentralThirdparty" are actually on our local intranet repo (which is also confusedly called "maven central").
Notice that it says there are 9 modules, but only 8 were downloaded. The first artifact in the list, "poc-domain-model" is the one that is not being downloaded, but I don't see why.
Here is my "ivysettings.xml" file:
<ivysettings>
<settings defaultResolver="default"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
<resolvers>
<chain name="default">
<filesystem name="local-maven2" m2compatible="true" >
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
<ibiblio name="mavenCentralSnapshots" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-snapshots"/>
<ibiblio name="mavenCentralThirdparty" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-3rd-party"/>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
And here is my "ivy.xml":
<ivy-module version="2.0">
<info organisation="com.att.ecom.poc" module="coherence_poc"/>
<dependencies>
<dependency org="com.att.ecom.poc" name="poc-domain-model" rev="0.0.1-SNAPSHOT"/>
<dependency org="org.apache.commons" name="commons-lang3" rev="3.1"/>
<dependency org="org.springframework" name="spring-aop" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-beans" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-context" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-core" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-expression" rev="4.0.0.RELEASE"/>
<dependency org="org.springframework" name="spring-web" rev="4.0.0.RELEASE"/>
<dependency org="com.oracle.coherence" name="coherence" rev="12.1.2-0-0"/>
</dependencies>
</ivy-module>
And finally, here's the excerpt from my build.xml that calls Ivy:
<target name="install-dependencies">
<ivy:resolve transitive="false" type="jar"/>
<ivy:retrieve conf="*" type="jar" pattern="${basedir}/lib/[artifact]-[type]-[revision].[ext]"/>
</target>
Is it obvious what my problem is, or is there something I can do to get more information?
Update:
Here is an elided version of my "com.att.ecom.poc-coherence_poc-default.xml" file:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="com.att.ecom.poc"
module="coherence_poc"
revision="working#<hostname>"
conf="default"
confs="default"
date="20140210084517"/>
<dependencies>
<module organisation="com.oracle.coherence" name="coherence">
<revision name="12.1.2-0-0" status="release" pubdate="20131118143843" resolver="mavenCentralThirdparty" artresolver="mavenCentralThirdparty" homepage="" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="8">
<metadata-artifact status="no" details="" size="2283" time="0" location="<homedir>\.ivy2\cache\com.oracle.coherence\coherence\ivy-12.1.2-0-0.xml" searched="false" origin-is-local="false" origin-location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-3rd-party/com/oracle/coherence/coherence/12.1.2-0-0/coherence-12.1.2-0-0.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="12.1.2-0-0" rev-constraint-default="12.1.2-0-0" rev-constraint-dynamic="12.1.2-0-0" callerrev="working#<hostname>"/>
<artifacts>
<artifact name="coherence" type="jar" ext="jar" status="no" details="" size="7027491" time="0" location="<homedir>\.ivy2\cache\com.oracle.coherence\coherence\jars\coherence-12.1.2-0-0.jar">
<origin-location is-local="false" location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-3rd-party/com/oracle/coherence/coherence/12.1.2-0-0/coherence-12.1.2-0-0.jar"/>
</artifact>
</artifacts>
</revision>
</module>
<module organisation="org.springframework" name="spring-web">
<revision name="4.0.0.RELEASE" status="release" pubdate="20131211234952" resolver="central" artresolver="central" homepage="https://github.com/SpringSource/spring-framework" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="7">
<license name="The Apache Software License, Version 2.0" url="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<metadata-artifact status="no" details="" size="5998" time="0" location="<homedir>\.ivy2\cache\org.springframework\spring-web\ivy-4.0.0.RELEASE.xml" searched="false" origin-is-local="false" origin-location="http://repo1.maven.org/maven2/org/springframework/spring-web/4.0.0.RELEASE/spring-web-4.0.0.RELEASE.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="4.0.0.RELEASE" rev-constraint-default="4.0.0.RELEASE" rev-constraint-dynamic="4.0.0.RELEASE" callerrev="working#<hostname>"/>
<artifacts>
<artifact name="spring-web" type="jar" ext="jar" status="no" details="" size="661567" time="0" location="<homedir>\.ivy2\cache\org.springframework\spring-web\jars\spring-web-4.0.0.RELEASE.jar">
<origin-location is-local="false" location="http://repo1.maven.org/maven2/org/springframework/spring-web/4.0.0.RELEASE/spring-web-4.0.0.RELEASE.jar"/>
</artifact>
</artifacts>
</revision>
</module>
... several other spring and commons artifacts resolved from central
<module organisation="com.att.ecom.poc" name="poc-domain-model">
<revision name="0.0.1-SNAPSHOT" status="integration" pubdate="20140207093019" resolver="mavenCentralSnapshots" artresolver="mavenCentralSnapshots" homepage="" downloaded="false" searched="false" default="false" conf="system, default, optional, compile, *, provided, runtime, javadoc, sources, master" position="0">
<metadata-artifact status="no" details="" size="3337" time="0" location="<homedir>\.ivy2\cache\com.att.ecom.poc\poc-domain-model\ivy-0.0.1-SNAPSHOT.xml" searched="false" origin-is-local="false" origin-location="<intranetmavenrepo>/nexus/content/repositories/cditspoc-snapshots/com/att/ecom/poc/poc-domain-model/0.0.1-SNAPSHOT/poc-domain-model-0.0.1-20140207.173018-85.pom"/>
<caller organisation="com.att.ecom.poc" name="coherence_poc" conf="default" rev="0.0.1-SNAPSHOT" rev-constraint-default="0.0.1-SNAPSHOT" rev-constraint-dynamic="0.0.1-SNAPSHOT" callerrev="working#<hostname>"/>
<artifacts>
</artifacts>
</revision>
</module>
</dependencies>
</ivy-report>
Update:
I finally noticed that the download fails because the exact fully-qualified path doesn't exist on the intranet repo. It's looking for a file with "SNAPSHOT" in the name, but the files in the directory only have timestamps, not "SNAPSHOT".
I noticed the following discussion, which seems relevant: enter link description here .
As a result of this, I modified by "ivysettings.xml" to the following slightly elided version:
<ivysettings>
<settings defaultResolver="default"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
<resolvers>
<chain name="default">
<filesystem name="local-maven2" m2compatible="true" >
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
<ibiblio name="mavenCentralSnapshots" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-snapshots"
pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
<ibiblio name="mavenCentralThirdparty" m2compatible="true"
root="http://<hostandport>/nexus/content/repositories/cditspoc-3rd-party"/>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
Unfortunately, this made no difference, it still just tries to find the "SNAPSHOT" file, which doesn't exist.
Update:
Actually, I realized another extremely important detail in that error where it fails to find the SNAPSHOT artifact on our MavenCentral. Here's the actual excerpt from the output:
:: problems summary ::
:::: WARNINGS
[FAILED ] com.att.ecom.poc#poc-domain-model;0.0.1-SNAPSHOT!poc-domain-model.jar(bundle): (0ms)
==== shared: tried
C:\Users\dk068x\.ivy2\shared\com.att.ecom.poc\poc-domain-model\0.0.1-SNAPSHOT\bundles\poc-domain-model.jar
==== public: tried
http://repo1.maven.org/maven2/com/att/ecom/poc/poc-domain-model/0.0.1-SNAPSHOT/poc-domain-model-0.0.1-SNAPSHOT.jar
What I should have noticed from this is that it isn't even trying to get the artifact from my snapshot repository at all. It's failing to find it on the public mavencentral, not mine. That tells me there's something wrong with my "ivysettings.xml", but I don't know what it would be.
Please check the comment above as well:
however in addition: change your ivy.xml to the following:
<ivy-module version="2.0">
<info organisation="com.att.ecom.poc" module="coherence_poc"/>
<dependencies>
<dependency org="com.att.ecom.poc" name="poc-domain-model" rev="0.0.1-SNAPSHOT"/>
</dependencies>
</ivy-module>
And then enable check the "ivy console" with debug level. (Ivy console in the console view of Eclipse) if possible.

ivy cannot d/l file but wget can

My ivy dependency:
<dependency org="googlecode.com" name="jslint4java" rev="2.0.1" e:suffix="-src">
<artifact name="jslint4java" type="zip"/>
</dependency>
My ivy settings:
<url name="googlecode">
<artifact pattern="http://[module].[organization]/files/[artifact]-[revision][suffix].[ext]"/>
</url>
...
<module organisation="googlecode.com" resolver="googlecode"/>
When I try to resolve the dependencies, I got the following error:
[ivy:retrieve] == resolving dependencies
...#blog;working#...->googlecode.com#jslint4java;2.0.2
[default->*] [ivy:retrieve] tried
http://jslint4java.googlecode.com/files/jslint4java-2.0.2-dist.zip
[ivy:retrieve] CLIENT ERROR: Not Found
url=http://jslint4java.googlecode.com/files/jslint4java-2.0.2-dist.zip
[ivy:retrieve] googlecode: no ivy file nor artifact found for
googlecode.com#jslint4java;2.0.2 [ivy:retrieve] WARN: module not found: googlecode.com#jslint4java;2.0.2 [ivy:retrieve] WARN: ====
googlecode: tried [ivy:retrieve] WARN: -- artifact
googlecode.com#jslint4java;2.0.2!jslint4java.zip: [ivy:retrieve] WARN:
http://jslint4java.googlecode.com/files/jslint4java-2.0.2-dist.zip
I tried to d/l the file by using the url in the last line with wget and the it went well.
But I cannot figure out why ivy failed to d/l the file.
So, I ran the ant task with -d flag to check more info and that's the outcome:
[ivy:resolve] HTTP response status: 404 url=http://jslint4java.googlecode.com/files/jslint4java-2.0.1-src.zip.sha1
[ivy:resolve] CLIENT ERROR: Not Found url=http://jslint4java.googlecode.com/files/jslint4java-2.0.1-src.zip.sha1
[ivy:resolve] HTTP response status: 404 url=http://jslint4java.googlecode.com/files/jslint4java-2.0.1-src.zip.md5
[ivy:resolve] CLIENT ERROR: Not Found url=http://jslint4java.googlecode.com/files/jslint4java-2.0.1-src.zip.md5
Notice that md5 doesn't exist, you have to override the checksums option in the resolver.
<url name="googlecode" checksums="sha1">
I tried the sha1 ONLY, (the default is sha1,md5) and it worked, even though the sha1 failed to download as well.
try to experiment in that area.
I suggest you setup a configuration in your ivy file.
Example
After running the build the following files are present:
|-- build.xml
|-- ivysettings.xml
|-- ivy.xml
`-- lib
`-- jslint4java-2.0.1-src.zip
ivy.xml
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="com.myspotontheweb" module="demo"/>
<configurations>
<conf name="source" description="source code distro"/>
</configurations>
<dependencies>
<dependency org="googlecode.com" name="jslint4java" rev="2.0.1" e:suffix="src" conf="source->default">
<artifact name="jslint4java" type="zip"/>
</dependency>
</dependencies>
</ivy-module>
Notes:
Added a "source" configuration. Logical grouping within my ivy project to differentiate from other kinds of dependency.
Note the extra "conf" attribute on the dependency. Mapped to the remote "default" configuration. Unless the remote module has an ivy or POM file default is the safest option.
Revised the extra attribute "suffix". Removed the "-" character. Not a big deal technically, I just think it's best not included in the dependency declaration.
ivysettings.xml
<ivysettings>
<settings defaultResolver="googlecode" />
<resolvers>
<url name="googlecode">
<artifact pattern="http://[module].[organization]/files/[artifact]-[revision]-[suffix].[ext]"/>
</url>
</resolvers>
</ivysettings>
Notes:
Personally I would explicitly state the hostname of the remote repository, here in the settings file (Instead of taking it from the dependency information). This will work though.
build.xml
<project name="demo" default="retrieve" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="retrieve" description="Use ivy to retrieve artifacts">
<ivy:retrieve pattern="lib/[artifact]-[revision](-[suffix]).[ext]" conf="source"/>
</target>
<target name="clean" description="Cleanup build files">
<delete dir="lib"/>
</target>
<target name="clean-all" depends="clean" description="Additionally purge ivy cache">
<ivy:cleancache/>
</target>
</project>
Notes:
Note how the "suffix" attribute is enclosed within parenthesis. This is an optional extra parameter and may not be part of a dependency.

Resources