How to dowload multiple Maven dependencies in Ivy with different classifiers? - java

I am trying to depend on Neo4j server jar and Neo4j server jar - static-web.jar in Ivy. I am trying something like
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="org.jimwebber" module="neo4j-koans"/>
<dependencies>
<dependency org="org.springframework.data" name="spring-data-neo4j" rev="1.0.0.RELEASE">
<exclude module="jms"/>
<exclude module="jmxtools"/>
<exclude module="jmxri"/>
<exclude org="org.slf4j" name="slf4j-log4j12"/>
</dependency>
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.11.RELEASE"/>
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.11.RELEASE"/>
<dependency org="org.neo4j.app" name="neo4j-server" rev="1.5-SNAPSHOT" m:classifier="static-web"/>
<dependency org="org.neo4j.app" name="neo4j-server" rev="1.5-SNAPSHOT"/>
<dependency org="org.neo4j" name="neo4j-community" rev="1.5-SNAPSHOT"/>
<dependency org="org.neo4j" name="neo4j-shell" rev="1.5-SNAPSHOT"/>
<dependency org="org.codehaus.jackson" name="jackson-core-asl" rev="1.7.5"/>
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.7.5"/>
<dependency org="com.sun.jersey" name="jersey-client" rev="1.3"/>
<dependency org="org.mockito" name="mockito-all" rev="1.8.5"/>
<dependency org="junit" name="junit" rev="4.7"/>
</dependencies>
</ivy-module>
But I never get the "staic-web".jar down, and now error either. Anyone knows how to do this?
Thanks for any hints!
/peter

This is how you retrieve more than one artifact associated with a Maven module:
<dependency org="org.neo4j.app" name="neo4j-server" rev="1.5-SNAPSHOT">
<artifact name="neo4j-server" type="jar" />
<artifact name="neo4j-server" type="jar" m:classifier="static-web"/>
</dependency>
The syntax is odd because of the way Maven references additional artifacts using classifiers.
The neo4j snapshot repository needs to be added into your ivysettings.xml file (snapshot releases are not published to Maven Central)
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="neo4j-snapshot" m2compatible="true" root="http://repo.neo4j.org/content/repositories/snapshots"/>
</chain>
</resolvers>
</ivysettings>
Other issues
Version corrections
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.11"/>
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.11"/>
Broken repository POM
The problem with using snapshot repos is sometimes the POMs are broken. Ivy is unable to process the following file:
http://repo.neo4j.org/content/repositories/snapshots/org/neo4j/app/neo4j-server/1.5-SNAPSHOT/neo4j-server-1.5-SNAPSHOT.pom
This prevents ivy from downloading the neo4j-server arifacts....
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve] io problem while parsing ivy file: http://repo.neo4j.org/content/repositories/snapshots/org/neo4j/app/neo4j-server/1.5-SNAPSHOT/neo4j-server-1.5-SNAPSHOT.pom: Impossible to load parent for file:/home/mark/.ivy2/cache/org.neo4j.app/neo4j-server/ivy-1.5-SNAPSHOT.xml.original. Parent=org.neo4j.build#parent-pom;25
[ivy:retrieve] module not found: org.neo4j.app#neo4j-server;1.5-SNAPSHOT
..
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: UNRESOLVED DEPENDENCIES ::
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: org.neo4j.app#neo4j-server;1.5-SNAPSHOT: not found
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
Work-around
In the settings file configure ivy to retrieve the artifacts directly using the url resolver. The ibiblio resolver is used for all other modules whose POMs are valid.
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="neo4j-snapshot" m2compatible="true" root="http://repo.neo4j.org/content/repositories/snapshots"/>
</chain>
<url name="neo4j-snapshot-hack">
<artifact pattern="http://repo.neo4j.org/content/repositories/snapshots/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
</url>
</resolvers>
<modules>
<module organisation="org.neo4j.app" name="neo4j-server" resolver="neo4j-snapshot-hack"/>
</modules>
</ivysettings>
This will mean transitive dependencies in the by-passed POM file might be skipped. Can't be helped if the POM is not working properly

Related

How to enforce HTTPS in ivy?

Here is my ivy.xml.
<ivy-module version="2.0">
<info organisation="kairosd.org" module="kairosdb"/>
<configurations defaultconf="default" >
<conf name="default"/>
<conf name="integration" extends="test"/>
<conf name="test" extends="default"/>
</configurations>
<dependencies>
<dependency org="com.google.guava" name="guava" rev="19.0" force="true">
<artifact name="guava" type="bundle" ext="jar"/>
</dependency>
<dependency org="com.github.rholder" name="guava-retrying" rev="2.0.0" />
<dependency org="org.apache.commons" name="commons-lang3" rev="3.4" />
<dependency org="org.apache.commons" name="commons-collections4" rev="4.1" />
<dependency org="org.json" name="org.json" rev="chargebee-1.0" />
<dependency org="com.google.code.gson" name="gson" rev="2.2.4" />
<dependency org="junit" name="junit" rev="4.12" conf="test->default" />
<dependency org="org.hamcrest" name="hamcrest-library" rev="1.3"
conf="test->default"/>
<dependency org="org.mockito" name="mockito-core" rev="2.13.0" conf="test->default"/>
<dependency org="io.netty" name="netty" rev="3.10.6.Final" />
<dependency org="org.powermock" name="powermock-module-junit4" rev="1.4.12" />-->
<dependency org="com.google.inject" name="guice" rev="4.1.0" />
<dependency org="com.google.inject.extensions"
name="guice-multibindings" rev="4.1.0"/>
<dependency org="com.google.inject.extensions" name="guice-assistedinject" rev="4.1.0" />
<dependency org="com.google.inject.extensions" name="guice-servlet" rev="4.1.0" />
<dependency org="com.h2database" name="h2" rev="1.3.170" />
<dependency org="se.ugli.bigqueue" name="bigqueue" rev="1.6.0.0" />
<!-- provides connection pooling -->
<dependency org="c3p0" name="c3p0" rev="0.9.1.2"/>
<dependency org="org.slf4j" name="slf4j-api" rev="1.7.2" />
<dependency org="org.slf4j" name="jul-to-slf4j" rev="1.7.2" />
<dependency org="org.apache.commons" name="commons-math3" rev="3.2" />
<dependency org="commons-io" name="commons-io" rev="2.5" />
<dependency org="com.beust" name="jcommander" rev="1.35" />
<dependency org="org.apache.httpcomponents" name="httpclient" rev="4.3.6" />
<dependency org="joda-time" name="joda-time" rev="2.3" />
<dependency org="ch.qos.logback" name="logback-core" rev="1.1.7" />
<dependency org="ch.qos.logback" name="logback-classic" rev="1.1.7" />
<!--Genormous dependencies-->
<dependency org="org.agileclick.genorm" name="genormous" rev="1.6.4.jdbc41">
<exclude org="javax.servlet" name="servlet-api"/>
<exclude org="org.agileclick.slickxml" name="slickxml"/>
<exclude org="org.agileclick.ultramc" name="ultramc"/>
</dependency>
<dependency org="jaxen" name="jaxen" rev="1.1.6" transitive="false">
<artifact name="jaxen" type="jar"/>
</dependency>
<!-- Cassandra Client -->
<dependency org="com.datastax.cassandra" name="cassandra-driver-core" rev="3.3.2" />
<dependency org="net.jpountz.lz4" name="lz4" rev="1.3.0"/>
<!-- Jetty server stuff -->
<dependency org="org.eclipse.jetty" name="jetty-server"
rev="8.1.16.v20140903"/>
<dependency org="org.eclipse.jetty" name="jetty-servlet"
rev="8.1.16.v20140903"/>
<dependency org="org.eclipse.jetty" name="jetty-servlets"
rev="8.1.16.v20140903"/>
<dependency org="org.eclipse.jetty.orbit" name="javax.servlet" rev="3.0.0.v201112011016">
<artifact name="javax.servlet" type="orbit" ext="jar"/>
</dependency>
<!--Jersey-->
<dependency org="com.sun.jersey.contribs" name="jersey-guice"
rev="1.18.3"/>
<dependency org="com.sun.jersey" name="jersey-server" rev="1.18.3"/>
<dependency org="com.fasterxml.jackson.jaxrs" name="jackson-jaxrs-json-provider" rev="2.2.3"/>
<dependency org="com.sun.jersey" name="jersey-core" rev="1.18.3"/>
<dependency org="com.sun.jersey" name="jersey-servlet" rev="1.18.3"
transitive="false"/>
<dependency org="com.sun.jersey.contribs.jersey-oauth" name="oauth-signature" rev="1.18.3" />
<dependency org="com.sun.jersey.contribs.jersey-oauth" name="oauth-server" rev="1.18.3" />
<!-- Pulse -->
<dependency org="javax.validation" name="validation-api" rev="1.0.0.GA"/>
<dependency org="org.apache.bval" name="bval-jsr303" rev="0.5"/>
<dependency org="com.google.code.findbugs" name="jsr305" rev="1.3.9"/>
<!-- Quartz -->
<dependency org="org.quartz-scheduler" name="quartz" rev="2.1.7" />
<!-- Codehale Metrics -->
<dependency org="com.codahale.metrics" name="metrics-healthchecks"
rev="3.0.2"/>
<dependency org="com.codahale.metrics" name="metrics-jvm" rev="3.0.2"/>
<dependency org="org.testng" name="testng" rev="6.8.5" conf="integration->default"/>
<!-- Prometheus -->
<dependency org="io.prometheus" name="simpleclient" rev="0.1.0"/>
<dependency org="io.prometheus" name="simpleclient_common" rev="0.1.0"/>
<dependency org="io.prometheus" name="simpleclient_httpserver" rev="0.1.0"/>
</dependencies>
</ivy-module>
ivysettings.xml:
<ivysettings>
<settings defaultResolver="default"/>
<resolvers>
<ibiblio name="local-m2" m2compatible="true"
root="file://${user.home}/.m2/repository"
changingPattern=".*SNAPSHOT"/>
<!--<ibiblio name="my-maven" m2compatible="true" root="http://repo.maven.apache.org/maven2/"/>-->
<!--<ibiblio name="staging" m2compatible="true" root="https://oss.sonatype.org/content/repositories/orgagileclick-1008"/>-->
<ibiblio name="central" m2compatible="true"/>
<filesystem name="local-m2-publish" m2compatible="true">
<artifact
pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
</filesystem>
<filesystem name="local-m2-publish-snapshot" m2compatible="true">
<artifact
pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]-SNAPSHOT/[artifact]-[revision]-SNAPSHOT.[ext]"/>
</filesystem>
<chain name="default">
<resolver ref="central"/>
<!--<resolver ref="staging"/>-->
<!--<resolver ref="local-m2"/>-->
</chain>
</resolvers>
</ivysettings>
This is the error I get.
===============================================
Ivy resolving dependencies.
:: problems summary ::
:::: WARNINGS
module not found: junit#junit;4.12
==== central: tried
http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.pom
-- artifact junit#junit;4.12!junit.jar:
http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar
module not found: org.hamcrest#hamcrest-library;1.3
==== central: tried
http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.pom
-- artifact org.hamcrest#hamcrest-library;1.3!hamcrest-library.jar:
http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar
module not found: org.mockito#mockito-core;2.13.0
==== central: tried
http://repo1.maven.org/maven2/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.pom
-- artifact org.mockito#mockito-core;2.13.0!mockito-core.jar:
http://repo1.maven.org/maven2/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.jar
module not found: org.testng#testng;6.8.5
==== central: tried
http://repo1.maven.org/maven2/org/testng/testng/6.8.5/testng-6.8.5.pom
-- artifact org.testng#testng;6.8.5!testng.jar:
http://repo1.maven.org/maven2/org/testng/testng/6.8.5/testng-6.8.5.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: junit#junit;4.12: not found
:: org.hamcrest#hamcrest-library;1.3: not found
:: org.mockito#mockito-core;2.13.0: not found
:: org.testng#testng;6.8.5: not found
::::::::::::::::::::::::::::::::::::::::::::::
:::: ERRORS
SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.pom
SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar
SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.pom
SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar
SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.pom
SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.jar
SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/testng/testng/6.8.5/testng-6.8.5.pom
SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/testng/testng/6.8.5/testng-6.8.5.jar
Exception tablesaw.TablesawException: Unable to resolve dependencies
Unable to resolve dependencies
===============================================
I think the error is due to HTTPS enforcement. How to do it?
I fixed it by adding a resolver, my-maven, with https root and add it to the chain. It should also work if I change the root of the central resolver.
<ivysettings>
<settings defaultResolver="default"/>
<resolvers>
<ibiblio name="local-m2" m2compatible="true"
root="file://${user.home}/.m2/repository"
changingPattern=".*SNAPSHOT"/>
<ibiblio name="my-maven" m2compatible="true" root="https://repo1.maven.org/maven2/"/>
<!--<ibiblio name="staging" m2compatible="true" root="https://oss.sonatype.org/content/repositories/orgagileclick-1008"/>-->
<ibiblio name="central" m2compatible="true"/>
<filesystem name="local-m2-publish" m2compatible="true">
<artifact
pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
</filesystem>
<filesystem name="local-m2-publish-snapshot" m2compatible="true">
<artifact
pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]-SNAPSHOT/[artifact]-[revision]-SNAPSHOT.[ext]"/>
</filesystem>
<chain name="default">
<resolver ref="central"/>
<resolver ref="my-maven"/>
<!--<resolver ref="local-m2"/>-->
</chain>
</resolvers>
</ivysettings>
and... about where you put that ivysettings.xml file, try the same dir as your build.xml see where do you put ivysettings.xml?
Please also try deleting older version of ivy from :
"C:\Users\userhome\.ant\lib\ivy.jar"
I had the same. Upgrade ivy.jar from 2.1.0 to 2.4.0 fixed the problem.

Log4j2 with apache Ivy dependancy management unable to resolve log4j-api-java9

When trying to use apache log4j2 with the ivy build management tool I get the following error when trying to resolve dependencies:
:: problems summary ::
:::: WARNINGS
module not found: org.apache.logging.log4j#log4j-api-java9;2.11.0
==== local: tried
C:\Users\Scott Neville\.ivy2\local\org.apache.logging.log4j\log4j-api-java9\2.11.0\ivys\ivy.xml
-- artifact org.apache.logging.log4j#log4j-api-java9;2.11.0!log4j-api-java9.zip:
C:\Users\Scott Neville\.ivy2\local\org.apache.logging.log4j\log4j-api-java9\2.11.0\zips\log4j-api-java9.zip
==== shared: tried
C:\Users\Scott Neville\.ivy2\shared\org.apache.logging.log4j\log4j-api-java9\2.11.0\ivys\ivy.xml
-- artifact org.apache.logging.log4j#log4j-api-java9;2.11.0!log4j-api-java9.zip:
C:\Users\Scott Neville\.ivy2\shared\org.apache.logging.log4j\log4j-api-java9\2.11.0\zips\log4j-api-java9.zip
==== public: tried
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api-java9/2.11.0/log4j-api-java9-2.11.0.pom
-- artifact org.apache.logging.log4j#log4j-api-java9;2.11.0!log4j-api-java9.zip:
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api-java9/2.11.0/log4j-api-java9-2.11.0.zip
module not found: org.apache.logging.log4j#log4j-core-java9;2.11.0
==== local: tried
C:\Users\Scott Neville\.ivy2\local\org.apache.logging.log4j\log4j-core-java9\2.11.0\ivys\ivy.xml
-- artifact org.apache.logging.log4j#log4j-core-java9;2.11.0!log4j-core-java9.zip:
C:\Users\Scott Neville\.ivy2\local\org.apache.logging.log4j\log4j-core-java9\2.11.0\zips\log4j-core-java9.zip
==== shared: tried
C:\Users\Scott Neville\.ivy2\shared\org.apache.logging.log4j\log4j-core-java9\2.11.0\ivys\ivy.xml
-- artifact org.apache.logging.log4j#log4j-core-java9;2.11.0!log4j-core-java9.zip:
C:\Users\Scott Neville\.ivy2\shared\org.apache.logging.log4j\log4j-core-java9\2.11.0\zips\log4j-core-java9.zip
==== public: tried
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core-java9/2.11.0/log4j-core-java9-2.11.0.pom
-- artifact org.apache.logging.log4j#log4j-core-java9;2.11.0!log4j-core-java9.zip:
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core-java9/2.11.0/log4j-core-java9-2.11.0.zip
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.apache.logging.log4j#log4j-api-java9;2.11.0: not found
:: org.apache.logging.log4j#log4j-core-java9;2.11.0: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
C:\Users\Scott Neville\Documents\fh\running_app\backend\build.xml:77: impossible to resolve dependencies:
This is using a ivy.xml of:
<ivy-module version="2.0">
<info organisation="uk.co.worldsofwar" module="sipsoc"/>
<dependencies>
<dependency org="org.eclipse.jetty" name="jetty-http" rev="9.4.9.v20180320"/>
<dependency org="org.eclipse.jetty" name="jetty-annotations" rev="9.4.9.v20180320" />
<dependency org="org.eclipse.jetty" name="jetty-webapp" rev="9.4.9.v20180320" />
<dependency org="org.freemarker" name="freemarker" rev="2.3.28" />
<dependency org="org.glassfish.jersey.core" name="jersey-server" rev="2.27" />
<dependency org="org.glassfish.jersey.containers" name="jersey-container-servlet" rev="2.27" />
<dependency org="org.glassfish.jersey.media" name="jersey-media-json-jackson" rev="2.27" />
<dependency org="com.auth0" name="java-jwt" rev="3.3.0" />
<dependency org="com.zaxxer" name="HikariCP" rev="3.1.0" />
<dependency org="org.postgresql" name="postgresql" rev="42.2.2" />
<dependency org="org.apache.logging.log4j" name="log4j-api" rev="2.11.0" />
<dependency org="org.apache.logging.log4j" name="log4j-core" rev="2.11.0" />
<exclude org="*" ext="*" type="source" />
<exclude org="*" ext="*" type="javadoc" />
<exclude org="*" ext="*" type="tests" />
</dependencies>
</ivy-module>
There is no special ivysettings.xml in play, just the defaults to collect from the public repos. The dependency resolution is done through ant just using a very standard . The Java Runtime is version 8 (as is the JDK).
Adding dependency configuration to split build from test dependencies resolve the issue for me:
In the ivy.xml
<configurations>
<conf name="build" description="development dependencies"/>
<conf name="test" extends="build" visibility="private" description="testing dependencies"/>
</configurations>
<dependencies>
<dependency org="org.apache.commons" name="commons-lang3" rev="3.9" conf="build->default"/>
<dependency org="org.apache.logging.log4j" name="log4j-core" rev="2.11.1" conf="build->default"/>
<dependency org="org.apache.logging.log4j" name="log4j-api" rev="2.11.1" conf="build->default"/>
<dependency org="junit" name="junit" rev="4.12" conf="test->default"/>
<dependency org="org.hamcrest" name="hamcrest" rev="2.1" conf="test->default"/>
</dependencies>
In build.xml to resolve dependencies:
<target name="resolve" depends="init-ivy" description="resolve project dependencies">
<ivy:resolve file="${ivy.file}"/>
<ivy:retrieve sync="true" type="jar, bundle" pattern="lib/[conf]/[artifact].[ext]"/>
</target>
This will place the dependencies in a folder structure that is easy for ant to compile test and build sources independently:
./lib/build/
./lib/test/
Example repository which I use as a Template

Ivy conf struggle

I am currently struggling with apache ivy's conf settings. Maybe i'll explain
what i want to achieve first:
I want two configurations: compile, runtime
I want for each configuration that ivy resolves, all jars including the transitive dependencies
Here's something i tried:
<configurations>
<conf name="compile" visibility="public"/>
<conf name="runtime" visibility="public" extends="compile"/>
</configurations>
<dependencies>
<dependency org="org.apache.ivy" name="ivy" rev="2.4.0" conf="runtime->runtime, compile->compile"/>
</dependencies>
But it cannot even be parsed:
The ivy file '...\ivy.xml' could not be parsed:
Could please someone tell me how to declare the conf settings properly, so that i can resolve using either compile or runtime and get all jars including the transitive dependencies(in the example case only the jars of ivy).
Update
Ok, thanks for the links. This makes it a bit clearer, but i'm still stuck.
I changed the dependency declaration so that it resolves the ivy jars in scope 'default':
(I left out the "compile->default" declaration, as it seems there's a bug in the
parsing of ivy eclipse plugin)
<dependency org="org.apache.ivy" name="ivy" rev="2.4.0" conf="runtime->default"/>
and retrieved the jars (using the ivy eclipse plugin) with the settings
confs='*' and types='*'.
All i got was a single ivy-2.4.0.jar. I expected all runtime dependencies. I can't exactly tell which they are, as i don't understand the declarations in ivy's xml file like(the whole xml file is appended later):
<dependency org="org.apache.ant" name="ant" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/>
Here's how i understand the conf="runtime->default" declaration:
The ivy dependency is assigned to (local) conf 'runtime'
The ivy dependency is assigned to remote conf 'default'
Whenever i resolve (or retrieve) the dependency for conf 'runtime' i
get all of the remote dependencies including the transitive dependencies
for conf 'default', as the 'default' conf is declared as
"The remote module's artifact and all it's runtime transitive dependencies" link
Here's my ivy.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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="My Name" module="jaculon.ivy" status="integration">
</info>
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
<conf name="provided" visibility="public" 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."/>
<conf name="runtime" visibility="public" 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." extends="compile"/>
<conf name="test" visibility="public" 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." extends="runtime"/>
<conf name="system" visibility="public" 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."/>
<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
<conf name="optional" visibility="public" description="contains all optional dependencies"/>
</configurations>
<dependencies>
<!-- Need ivy to resolve the jars. -->
<dependency org="org.apache.ivy" name="ivy" rev="2.4.0" conf="runtime->default"/>
</dependencies>
</ivy-module>
Here's the content the ivy-2.4.0.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="org.apache.ivy"
module="ivy"
revision="2.4.0"
status="release"
publication="20141222174010"
>
<description homepage="http://ant.apache.org/ivy/" />
<m:properties__project.build.sourceEncoding>UTF-8</m:properties__project.build.sourceEncoding>
<m:properties__organization.logo>http://www.apache.org/images/asf_logo_wide.gif</m:properties__organization.logo>
<m:properties__distMgmtSnapshotsName>Apache Development Snapshot Repository</m:properties__distMgmtSnapshotsName>
<m:properties__distMgmtSnapshotsUrl>https://repository.apache.org/content/repositories/snapshots</m:properties__distMgmtSnapshotsUrl>
<m:maven.plugins>org.apache.maven.plugins__maven-remote-resources-plugin__null|org.apache.maven.plugins__maven-remote-resources-plugin__null</m:maven.plugins>
<m:properties__sourceReleaseAssemblyDescriptor>source-release</m:properties__sourceReleaseAssemblyDescriptor>
</info>
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
<conf name="provided" visibility="public" 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."/>
<conf name="runtime" visibility="public" 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." extends="compile"/>
<conf name="test" visibility="private" 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." extends="runtime"/>
<conf name="system" visibility="public" 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."/>
<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
<conf name="optional" visibility="public" description="contains all optional dependencies"/>
</configurations>
<publications>
<artifact name="ivy" type="jar" ext="jar" conf="master"/>
<artifact name="ivy" type="source" ext="jar" conf="sources" m:classifier="sources"/>
<artifact name="ivy" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/>
</publications>
<dependencies>
<dependency org="org.apache.ant" name="ant" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="org.apache.ant" name="ant-nodeps" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="org.apache.ant" name="ant-trax" rev="1.7.1" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.0" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="oro" name="oro" rev="2.0.8" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="commons-vfs" name="commons-vfs" rev="1.0" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="com.jcraft" name="jsch" rev="0.1.50" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.6" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.6" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.6" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="org.bouncycastle" name="bcpg-jdk14" rev="1.45" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="org.bouncycastle" name="bcprov-jdk14" rev="1.45" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="junit" name="junit" rev="3.8.2" force="true" conf="test->runtime(*),master(*)"/>
<dependency org="commons-lang" name="commons-lang" rev="2.6" force="true" conf="test->runtime(*),master(*)"/>
<dependency org="org.apache.ant" name="ant-testutil" rev="1.7.0" force="true" conf="test->runtime(*),master(*)">
<exclude org="*" module="*" name="*" type="*" ext="*" conf="" matcher="exact"/>
</dependency>
<dependency org="ant" name="ant-launcher" rev="1.6.2" force="true" conf="test->runtime(*),master(*)">
<exclude org="*" module="*" name="*" type="*" ext="*" conf="" matcher="exact"/>
</dependency>
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" force="true" conf="test->runtime(*),master(*)">
<exclude org="*" module="*" name="*" type="*" ext="*" conf="" matcher="exact"/>
</dependency>
<dependency org="xerces" name="xercesImpl" rev="2.6.2" force="true" conf="test->runtime(*),master(*)"/>
<dependency org="xerces" name="xmlParserAPIs" rev="2.6.2" force="true" conf="test->runtime(*),master(*)"/>
</dependencies>
</ivy-module>
Sounds like an XML formatting problem.
The following examples demonstrate how ivy configurations can be used to manage separate "compile", "runtime" and "test" classpaths:
Ivy, what is the master configuration and why is it not pulling jvyaml?
Class not found with Ant, Ivy and JUnit - error in build.xml?

Where is Ivy repository for xuggle-utils.jar?

I am trying to compile Xuggler under windows. It's ivy.xml file contains the following dependency:
<dependency org="xuggle" name="xuggle-utils" rev="latest.integration" conf="test" changing="true"/>
Unfortunately, this dependency cannot be found int any repository, configured in this project.
Where is up to date version of repo for xuggler?
This will be fixed in Xuggler 5.3 (launches next week). It is already in the github project as [cross_compile 1489166].
https://github.com/xuggle/xuggle-xuggler
Enjoy.
There seems to be a file http://xuggle.googlecode.com/svn/trunk/build/java/ivysettings.xmlwhich suggests http://xuggle.googlecode.com/svn/trunk/repo/share/java/ as the repo, so you might try that one.
A problem might be that the repository might not be queryable and thus rev="latest.integration" might cause problems, since Ivy can't query the repo for the available versions.
The settings file in the project's source does not appear to be working.
I think discovered the locations of both the xuggle jars and the secondary repository used to host the module's transitive dependencies (contained in the xuggle module ivy.xml).
Example ivy.xml and ivysettings.xml files included below.
ivy.xml
<ivy-module version="2.0">
<info organisation="org.demo" module="demo"/>
<configurations>
<conf name="compile"/>
<conf name="runtime" extends="compile"/>
<conf name="test" extends="runtime"/>
</configurations>
<dependencies>
<dependency org="xuggle" name="xuggle-utils" rev="latest.integration" conf="test->default"/>
</dependencies>
</ivy-module>
ivysettings.xml
<ivysettings>
<settings defaultResolver="central"/>
<resolvers>
<ibiblio name="central" m2compatible="true"/>
<url name="xuggle">
<ivy pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organisation]/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="http://xuggle.googlecode.com/svn/trunk/repo/share/java/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="red5">
<artifact pattern="http://red5.googlecode.com/svn/repository/[artifact]-[revision].[ext]" />
</url>
</resolvers>
<modules>
<module organisation="xuggle" resolver="xuggle" />
<module organisation="red5" resolver="red5" />
</modules>
</ivysettings>

Does Ivy's url resolver support transitive retrieval?

For some reason I can't seem to resolve the dependencies of my dependencies when using a url resolver to specify a repository's location. However, when using the ibiblio resolver, I am able to retrieve them.
For example:
<!-- Ivy File -->
<ivy-module version="1.0">
<info organisation="org.apache" module="chained-resolvers"/>
<dependencies>
<dependency org="commons-lang" name="commons-lang" rev="2.0" conf="default"/>
<dependency org="checkstyle" name="checkstyle" rev="5.0"/>
</dependencies>
</ivy-module>
<!-- ivysettings file -->
<ivysettings>
<settings defaultResolver="chained"/>
<resolvers>
<chain name="chained">
<url name="custom-repo">
<ivy pattern="http://my.internal.domain.name/ivy/[organisation]/[module]/[revision]/ivy-[revision].xml"/>
<artifact pattern="http://my.internal.domain.name/ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</url>
<url name="ibiblio-mirror" m2compatible="true">
<artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<ibiblio name="ibiblio" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
<!-- checkstyle ivy.xml file generated from pom via ivy:install task -->
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="1.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="checkstyle"
module="checkstyle"
revision="5.0"
status="release"
publication="20090509202448"
namespace="maven2"
>
<license name="GNU Lesser General Public License" url="http://www.gnu.org/licenses/lgpl.txt" />
<description homepage="http://checkstyle.sourceforge.net/">
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard
</description>
</info>
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
<conf name="provided" visibility="public" 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."/>
<conf name="runtime" visibility="public" 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." extends="compile"/>
<conf name="test" visibility="private" 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." extends="runtime"/>
<conf name="system" visibility="public" 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."/>
<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
<conf name="optional" visibility="public" description="contains all optional dependencies"/>
</configurations>
<publications>
<artifact name="checkstyle" type="jar" ext="jar" conf="master"/>
</publications>
<dependencies>
<dependency org="antlr" name="antlr" rev="2.7.6" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="apache" name="commons-beanutils-core" rev="1.7.0" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="apache" name="commons-cli" rev="1.0" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="apache" name="commons-logging" rev="1.0.3" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="com.google.collections" name="google-collections" rev="0.9" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
</dependencies>
</ivy-module>
Using the "ibiblio" resolver I have no problem resolving my project's two dependencies (commons-lang 2.0 and checkstyle 5.0) and checkstyle's dependencies. However, when attempting to exclusively use the "custom-repo" or "ibiblio-mirror" resolvers, I am able to resolve my project's two explicitly defined dependencies, but not checkstyle's dependencies.
Is this possible? Any help would be greatly appreciated.
The reason is you didn't specify an ivy pattern for your 'ibibio-mirror' resolver. Your mirror should look somthing like (don't forget the [classifier] token):
<url name="ibiblio-mirror" m2compatible="true">
<ivy pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
<artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
</url>
But you could also use the ibiblio resolver for your mirror:
<ibiblio name="ibiblio-mirror" root="http://mirrors.ibiblio.org/pub/mirrors/maven2/" m2compatible="true"/>
Maarten

Categories