Ivy custom url resolver - ant

I am trying to create custom resolver in my ivysettings.xml file:
<ivysettings>
<settings defaultResolver="default"/>
<resolvers>
<chain name="default">
<url name="scala-tools">
<ivy pattern="http://scala-tools.org/repo-releases/[organisation]/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="http://scala-tools.org/repo-releases/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
<artifact pattern="http://scala-tools.org/repo-releases/[organisation]/[module]/[revision]/[artifact].[ext]"/>
</url>
<!--<ibiblio name="ibiblio"/>-->
</chain>
</resolvers>
</ivysettings>
As you can see, I have just one UrlResolver that will try to find my dependencies in scala-tools repo. If I specify my dependencies correctly than ivy will try to find it in http://scala-tools.org/repo-releases/org.scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar and http://scala-tools.org/repo-releases/org.scala-lang/scala-library/2.8.0/scala-library.jar (yep, according to my instructions in ivysettings.xml) Obviously, it doesn't find anything. To get thing working I must specify dependencies in this way:
<ivy-module version="2.2">
<info organisation="org.yoba" module="Yoba"/>
<dependencies>
<dependency org="org/scala-lang" name="scala-library" rev="2.8.0"/>
<!--<dependency org="org.scala-lang" name="scala-library" rev="2.8.0"/>-->
<dependency org="org/scala-lang" name="scala-compiler" rev="2.8.0"/>
<!--<dependency org="org.scala-lang" name="scala-compiler" rev="2.8.0"/>-->
</dependencies>
</ivy-module>
Q:How to change artifact pattern / something else to force ivy to make it's job right way?
1: http://scala-tools.org/repo-releases/ scala-tools repo

ivy.xml
I checked the POM for scala-compiler and discovered that it references the module scala-library. This means only need one dependency declaration is required in the ivy file:
<ivy-module version="2.0">
<info organisation="org.yoba" module="Yoba"/>
<dependencies>
<dependency org="org.scala-lang" name="scala-compiler" rev="2.8.0" conf="default"/>
</dependencies>
</ivy-module>
The version number needs to be "2.0"
Included the default mapping to avoid downloading the optional dependencies
ivysettings.xml
I recommend using the ibiblio resolver when downloading from any Maven compliant repository.
<ivysettings>
<settings defaultResolver="scalatools"/>
<resolvers>
<ibiblio name="scalatools" root="http://scala-tools.org/repo-releases" m2compatible="true"/>
</resolvers>
</ivysettings>
If you need to download other libraries the settings file can be enhanced, so that ivy only retrieves the scala modules from the scala repository
<ivysettings>
<settings defaultResolver="central"/>
<resolvers>
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="scalatools" root="http://scala-tools.org/repo-releases" m2compatible="true"/>
</resolvers>
<modules>
<module organisation="org.scala-lang" resolver="scalatools"/>
</modules>
</ivysettings>

Related

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.

Using status in IVY, works for the "less stable one" (ie integration), not for the other (ie milestone and release)

I am trying desperately to have this working. I've spent the whole day on it and can't find what's wrong.
It seems that IVY can resolve only the "less stable status" in the statuses list, ie for the default ones, only integration not milestone or release.
This is a test ant file.
<project name="helicopter" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<ivy:settings file="ivysettings.xml" id="ivy.instance"/>
<!-- the call to resolve is not mandatory, retrieve makes an implicit call if we don't -->
<ivy:resolve file="ivy.xml" />
<ivy:retrieve type="swc" pattern="../libs/bin/[module]-[revision].[ext]" />
<ivy:retrieve type="src" pattern="../libs/src/[module]-[revision].[ext]" />
</project>
This is the ivysettings.xml
<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
<settings defaultResolver="local" />
<resolvers>
<filesystem
name="local"
checkmodified="true">
<artifact pattern="C:/repository/[organisation]/[module]/[revision]/[artifact].[ext]" />
</filesystem>
</resolvers>
</ivysettings>
And this is the ivy.xml
<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="com.org"
module="moduleA"
status="integration"
/>
<publications>
<artifact type="swf" ext="swf" />
<artifact type="src" ext="src.zip" />
</publications>
<dependencies>
<dependency org="com.org" name="moduleB" rev="latest.integration">
<artifact name="moduleB" type="swc" ext="swc" />
<artifact name="moduleB" type="src" ext="src.zip" />
</dependency>
</dependencies>
</ivy-module>
And the moduleB ivy.xml in the repository (folder)
<info organisation="com.org" module="moduleB" revision="0.0.5.0" status="integration" publication="20111201174403"/>
<publications>
<artifact type="swc" ext="swc"/>
<artifact type="src" ext="src.zip"/>
</publications>
<dependencies>
</dependencies>
So this will work, the moduleB will be downloaded all right.
Now if I edit the ivy.xml to get the latest.milestone
<info
organisation="com.org"
module="moduleA"
status="integration"
/>
<publications>
<artifact type="swf" ext="swf" />
<artifact type="src" ext="src.zip" />
</publications>
<dependencies>
<dependency org="com.org" name="moduleB" rev="latest.milestone">
<artifact name="moduleB" type="swc" ext="swc" />
<artifact name="moduleB" type="src" ext="src.zip" />
</dependency>
</dependencies>
</ivy-module>
and edit the ivy.xml of my published moduleB (so editing in the repository folder) to be of status milestone
<info organisation="com.org" module="moduleB" revision="0.0.5.0" status="milestone" publication="20111201174403"/>
<publications>
<artifact type="swc" ext="swc"/>
<artifact type="src" ext="src.zip"/>
</publications>
<dependencies>
</dependencies>
it won't work, the artifact won't be found, although listed
:: problems summary ::
:::: WARNINGS
module not found: com.org#moduleB;latest.milestone
==== local: tried
-- artifact com.org#moduleB;latest.milestone!moduleB.src.zip(src):
C:/repository/com.org/moduleB/revision]/moduleB.src.zip
[0.0.5.0 (MD)]
-- artifact com.org#moduleB;latest.milestone!moduleB.swc:
C:/repository/com.org/moduleB/[revision]/moduleB.swc
[0.0.5.0 (MD)]
Now the FUN PART!
Before using the defaults statuses from IVY I used mine.
It had the exact same behavior (that's why I tried the defaults one then).
The fun bits is that if I had
<statuses default="status-dev">
<status name="status-stable" integration="false"/>
<status name="status-test" integration="false"/>
<status name="status-dev" integration="true" />
</statuses>
The only latest.[status] working will be for status-dev.
Now if I change the status order to
<statuses default="status-dev">
<status name="status-stable" integration="false"/>
<status name="status-dev" integration="true" />
<status name="status-test" integration="false"/>
</statuses>
The only one working will be status-test.
I' puzzled here... :/
Thanks for any help you could provide.
Cheers,
Xavier
I have created a basic project showing the weird behavior.
moduleB is the module being published.
moduleA is the module getting moduleB as a dependency.
Please update the path to the local repository in both ivysettings file
The link to download the file
https://rapidshare.com/files/1326835940/test_ivy.zip
Wow, that looks like a very strange overloading of the dependency construct. I would stick with a simpler ivy.xml, with a single dependency upon moduleB. Just change the rev attribute at runtime using a property file. That is, coalesce all of your dependencies into:
<dependency org="com.org" name="moduleB" rev="${dependency.rev.moduleB}"
conf="build-release->default;build-milestone->default;build-devs->default">
<artifact name="shared" type="swc" ext="swc" />
<artifact name="shared" type="src" ext="src.zip" />
</dependency>
You can even supply a default value to the property (for IvyDE, for example) in your ivy-settings.xml:
<property name="dependency.rev.moduleB"
value="latest.integration"
override="false"/>
Also, you'll want to edit your ivysettings.xml to include a pattern for the repository to find ivy.xml files:
<resolvers>
<filesystem
name="local"
checkmodified="true">
<artifact pattern="C:/repository/[organisation]/[module]/[revision]/[artifact].[ext]" />
<ivy pattern="C:/repository/[organisation]/[module]/[revision]/ivy.xml" />
</filesystem>
</resolvers>

Apache ivy. JbossAS, dependencies and some basic questions on ivy

I'm totally new in ivy, so don't blame for for rather elementary questions.
I'm working on project that depends on some libraries of jbossAS 4.0.3.
To tell exactly - there are jboss-4.0.3-scheduler, jboss-4.0.3-jboss-system, jboss-4.0.3-jboss, jboss-4.0.3-jbossall-client. So i have a logical question - how can I point ivy to find them on public repository? Or that's the wrong direction of leveraging ivy in this situation?
And another simple question - for example, in the past this project depended on castor-0.9.7, axis-1.3 and log4j - after ivy dependency resolution - I had a lot of other jars like activation-1.1.jar, axis-saaj-1.3.jar, mail-1.4.jar and so on. So it was only 3 jars in dependencies in the past - now I have 10. Do i really need them?
And what is the way to know for sure what do i need of this additional jars?? (after all the project was working with old config - 3 jars).
And what if I have some artifact(dependee project). Other project depends on it, but i don't want transitive dependencies to be resolved. That's only a question of interest ))
This is how i am pulling dependencies now (from local repo), and what i want - to pull them from public repo (if it is possible) :
<ivy-module version="2.2">
<info organisation="org.btl" module="BtlAppServer" revision="1.7"/>
<configurations defaultconfmapping="default">
<conf name="compile" visibility="private"/>
<conf name="test" extends="compile" visibility="private"/>
<conf name="master" />
<conf name="runtime" extends="compile" />
<conf name="default" extends="master,runtime"/>
</configurations>
<publications>
<artifact conf="master"/>
</publications>
<dependencies>
<dependencies>
<dependency org="jboss" name="jboss" rev="4.0.3" conf="*->default" />
<dependency org="jboss" name="jbossall-client" rev="4.0.3"
conf="*->default"/>
<dependency org="jboss" name="jboss-system" rev="4.0.3" conf="*->default"/>
<dependency org="jboss" name="scheduler-plugin" rev="4.0.3"
conf="*->default"/>
<dependency org="org.btl" name="BtlCommon" rev="latest.integration" />
</dependencies>
</ivy-module>
setttings file for this stuff :
<ivysettings>
<settings defaultResolver="myChain"/>
<include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
<resolvers>
<chain name="myChain" returnFirst="true">
<resolver ref="local"/>
<!-- JBoss -->
<ibiblio name="jboss-nexus" m2compatible="true"
root="https://repository.jboss.org/nexus/content/groups/developer/"
pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-
[classifier]).[ext]"/>
<ibiblio name="ibiblio" m2compatible="true" />
</chain>
</resolvers>
<modules>
<module organisation='org.btl' resolver='local' />
</modules>
</ivysettings>
File ivy.xml for the second question :
<ivy-module version="2.2">
<info organisation="org.btl" module="BtlCommon" revision="1.7"/>
<configurations defaultconfmapping="default">
<conf name="compile" visibility="private"/>
<conf name="test" extends="compile" visibility="private"/>
<conf name="master" />
<conf name="runtime" extends="compile" />
<conf name="default" extends="master,runtime"/>
</configurations>
<publications>
<!--get the artifact from our module name-->
<artifact conf="master"/>
</publications>
<dependencies>
<dependency org="axis" name="axis" rev="1.3" conf="*->default" />
<dependency org="castor" name="castor" rev="0.9.7" conf="*->default" />
<dependency org="log4j" name="log4j" rev="1.2.15" conf="*->default" >
<exclude org="com.sun.jdmk"/>
<exclude org="com.sun.jmx"/>
<exclude org="javax.jms"/>
</dependency>
</dependencies>
</ivy-module>
Don't know if that can help someway )
The extra jars are produced by transitive dependencies. These may not be needed to compile your project but needed at runtime.
If they are actually needed depends on the dependency itself and your usage of the library. Mail.jar(Java Mail API) for example is only needed if you need to send Mails.
I think it will be quite complicated to really make sure, that you won't need the extra libraries (in the future?). If you are sure now, that you program runs without them, you can just set the transitive attribute to the dependency. And they will not be downloaded.
<dependency org="axis" name="axis" rev="1.3" conf="*->default" transitive="false"/>
I found the Jboss dependencies in the java.net repository for revision="4.2.2.GA". Seems the best option. But I couldn't find the scheduler.
ivysettings.xml
<ibiblio name="jboss-java.net" m2compatible="true"
root="http://download.java.net/maven/2/"/>

Can't get Apache Ivy not to download sources from Spring repository

In my project, I use Ivy to resolve dependencies. I use Spring's repository. The problem is that I don't want to download sources and licence/notice files. The settings which produce the problem are as follows:
ivyconf.xml
<ivysettings>
<settings defaultResolver="default" />
<resolvers namespace="apache">
<chain name="default" returnFirst="true">
<url name="com.springsource.repository.bundles.release">
<!--<ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />-->
<!-- or this one? -->
<ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.external">
<!--<ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />-->
<ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>
ivy.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="file:///home/nikem/workspace/ark/test.xsl"?>
<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="com.foo-corp" module="bar" />
<configurations>
<conf name="runtime" description="Modules needed for running the application"/>
</configurations>
<dependencies>
<dependency org="org.apache.batik" name="com.springsource.org.apache.batik.dom.svg" rev="1.7.0" conf="runtime->runtime">
<exclude type="src" ext="jar" conf="runtime"/>
</dependency>
<dependency org="org.apache.batik" name="com.springsource.org.apache.batik.bridge" rev="1.7.0" conf="runtime->runtime" />
<exclude type="src" ext="jar" conf="runtime"/>
<exclude type="javadoc" ext="jar" conf="runtime"/>
<exclude type="license" ext="txt" conf="runtime"/>
</dependencies>
</ivy-module>
build.xml
<project name="yunowork" default="ivy-runtime" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="run.lib.dir" value="projlib"/>
<property name="lib.dir" value="lib"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${lib.dir}/ivy.jar"/>
<target name="clean-lib" description="Removes all libraries">
<delete dir="${run.lib.dir}" includes="*.jar"/>
</target>
<target name="ivy-clean-cache" description="Cleans Ivy cache">
<ivy:cleancache />
</target>
<target name="ivy-runtime">
<ivy:settings file="ivyconf.xml"/>
<ivy:resolve file="ivy.xml"/>
<ivy:retrieve pattern="${run.lib.dir}/[artifact].[ext]" conf="runtime"/>
</target>
</project>
In Ivy's cache I see:
<publications>
<artifact name="com.springsource.org.apache.batik.dom.svg"/>
<artifact name="com.springsource.org.apache.batik.dom.svg-sources" type="src" ext="jar"/>
<artifact name="license" type="license" ext="txt"/>
<artifact name="notice" type="license" ext="txt"/>
</publications>
They are published for all the configs by defaults.
The question is: Why don't the source and licence files get excluded?
One workaround to achieve what I want (no sources, no licence/notice files) was to add type to <ivy:retrieve> task.
<ivy:retrieve pattern="${run.lib.dir}/[artifact].[ext]" type="jar" />
In this case, I don't need any <exclude> tags. This, however, doesn't answer the question why exclude didn't work in the first place.
Could you try (omit the nested exclude in the first dependency):
<dependencies>
<dependency org="org.apache.batik" name="com.springsource.org.apache.batik.dom.svg" rev="1.7.0" conf="runtime->runtime"/
<dependency org="org.apache.batik" name="com.springsource.org.apache.batik.bridge" rev="1.7.0" conf="runtime->runtime" />
<exclude type="src" ext="jar" conf="runtime"/>
<exclude type="javadoc" ext="jar" conf="runtime"/>
<exclude type="license" ext="txt" conf="runtime"/>
</dependencies>
I have a feeling that the deeply nested exclude may be bugged. See here:
How to exclude commons logging dependency of spring with ivy?
It's just a hunch, everything seems very fine.
I've answered a similar question on Spring here.
In brief it amounts to:
1) Clear your ivy cache
2) Change your ivy settings file to use the Spring Maven repositories:
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="spring-release" root="http://repository.springsource.com/maven/bundles/release" m2compatible="true"/>
<ibiblio name="spring-external" root="http://repository.springsource.com/maven/bundles/external" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
3) Try change your configuration mapping from:
<dependency .... conf="runtime->runtime"/>
to:
<dependency .... conf="runtime->default"/>
Instead of trying to exclude all of the artifacts you don't want, try explicitly including only the artifacts you do want:
<dependency org="org.apache.batik" name="com.springsource.org.apache.batik.dom.svg" rev="1.7.0" conf="runtime->runtime">
<artifact name="com.springsource.org.apache.batik.dom.svg"/>
</dependency>

ivy - create local repository to pull multiple jar files from same location

I have a local repository, in which i can put one jar and retrieve it using ivy. Now for svnant, I want to put 4 jar files in one folder and try to use ivy to retrieve it. my patten in org/module/version/module-version.jar. how do i perform this.
In your ivysettings.xml file define a filesystem resolver with an artifact pattern matching the location of your 4 jars.
<ivysettings>
<settings defaultResolver="local-repo"/>
<resolvers>
<filesystem name="local-repo">
<ivy pattern="${ivy.settings.dir}/repo/[organisation]/[module]/[revision]/ivy.xml"/>
<artifact pattern="${ivy.settings.dir}/repo/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</filesystem>
</resolvers>
</ivysettings>
Ivy will then be able to find your jars.
Update
In order to group the 4 jars as one module save the following ivy.xml file and store it with the jars
<ivy-module version="2.0">
<info organisation="myorg" module="svnant" revision="1.0"/>
<publications>
<artifact name="svnant"/>
<artifact name="svnclientadapter"/>
<artifact name="svnkit"/>
<artifact name="svnjavahl"/>
</publications>
</ivy-module>
Note: The revision number in the ivy.xml must match the revision number of the module
The dependency in the ivy.xml file is then
<dependency org="myorg" name="svnant" rev="1.0"/>

Resources