I have been searching around for ages trying to find a solution to my problem, but all of the other posts I have come across either don't work or don't match my situation, so hopefully someone can give me some insight.
I have a library that I am build with ant, which outputs 2 jar files, one as normal containing the compiled version of the library, and another containing just the source files.
This library is uploaded to our Nexus repository with packaging set to jar. For the actual jar file I set extension to jar and leave classifier blank. For the source jar I set classifier to sources and extension to jar.
No matter what I do with my ivy.xml file I can't get it to download the sources jar. Based on posts I have read elsewhere I tried adding:
conf="*->default,sources"
to my dependency, but then I get an error:
configuration not found in org#name;version: 'sources'
So this is basically expecting my library to define sources as a configuration somewhere? I thought it would just pick up the fact that there is another artefact with the classifier set to sources in the repository.
Can anyone give me other suggestions of what I might be doing wrong either with the way I have published my library to Nexus, or with how I have set up my dependency declaration in my Ivy file.
This is the basic Ivy.xml file where I am defining my dependency on the library that I have put in Nexus.
<ivy-module version="2.0">
<info organisation="${ivy.organisation}" module="moduleName" />
<configurations>
<conf name="pda" description="moduleName for PDA"/>
<conf name="server" description="moduleName for server"/>
</configurations>
<dependencies>
<!-- Internal -->
<dependency name="utility" org="${ivy.organisation}" rev="latest.integration" conf="${ivy.configuration}"/>
<dependency name="myLib" org="my.org" rev="0.0.+"/>
</dependencies>
</ivy-module>
In response to comments below, the ivy.configuration property is set to pda within my build.properties for Ant. For Eclipse I have created a properties file and also set ivy.configuration to pda (this properties file is then referenced in the Ivy settings within Eclipse).
The error message I get is:
Some projects fail to be resolved
Impossible to resolve dependencies of ${ivy.organisation}#moduleName;working@host
unresolved dependency: my.org#myLib;0.0.+: configuration not found in my.org#myLib;0.0.0: 'sources'. It was required from ${ivy.organisation}#moduleName;working@host pda
UPDATE Here is the resolved ivy.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
<info organisation="my.org"
module="myLib"
revision="0.0.0"
status="release"
publication="20120419131909"
default="true"
/>
<configurations>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="myLib" type="jar" ext="jar" conf="default"/>
</publications>
</ivy-module>
This obviously explains why it fails to find the 'sources' conf. But I was under the impression that the sources conf should be added automatically because I have added the sources to Nexus.