We have a slight convoluted situation...
For the most part we've been using IVY and ANT to manage our builds and dependencies. Now the company is moving towards using Maven. We have a set of projects called common libraries which are used by several of the core products.
Common libraries use IVY and are published to an IVY repository. We also need to make common libraries available for our new Maven projects. So when common libraries get built and published, I've modified the script to publish to Maven (Artifactory) as well IVY. Here are the two targets that now get called when publishing the built IVY projects:
<target name="publish-ivyrepo" depends="load-ivysettings">
<ivy:resolve file="ivy.xml" />
<ivy:publish
module="${ant.project.name}"
artifactspattern="${dist.dir}/[artifact].[ext]"
resolver="integration"
pubrevision="${build.version}"
status="integration"
overwrite="true"
update="true"/>
</target>
<target name="publish-artifactory" depends="load-ivysettings">
<ivy:resolve file="ivy.xml" />
<ivy:publish
module="${ant.project.name}"
artifactspattern="${dist.dir}/[artifact].[ext]"
resolver="artifactory"
pubrevision="${build.version}-SNAPSHOT"
status="integration"
overwrite="true"
update="true"/>
</target>
And here is the IVY settings detailing the resolvers:
<sftp name="integration" checkmodified="true" changingPattern=".*" host="host" user="ivy" userPassword="abc">
<ivy pattern="${ivy.integration.default.root}/${ivy.public.default.ivy.pattern}"/>
<artifact pattern="${ivy.integration.default.root}/${ivy.public.default.artifact.pattern}"/>
</sftp>
<url name="artifactory" checkmodified="false" changingPattern=".*" m2compatible="true">
<ivy pattern="http://server/artifactory/libs-snapshot-local/${maven.default.ivy.pattern}"/>
<artifact pattern="http://server/artifactory/libs-snapshot-local/${maven.default.artifact.pattern}"/>
</url>
This kind of works in that I now see the common library jars within Artifactory, with SNAPSHOT substituted for the unique timestamp. However, the source jar and the IVY xml file doesn't have SNAPSHOT substituted. Also, no POM file is being generated (though I dont know if this is necessary.
So this appears to be okay, though there are questions around the need for the POM file and the version naming of the IVY xml and the source jar. However, when I now proceed to specify a dependency from one of the Maven projects to one of the SNAPSHOT versions of the common library projects, it complains that it cannot resolve the dependency:
Missing artifact com.smartstream.common_library:common_library_dao:jar:4.0.0.5-4-SNAPSHOT:compile
I've tried specifying the repositories to Artifactory via the POM file and via the Maven settings file will little success:
<repository>
<id>test</id>
<name>simple test</name>
<url>http://server/artifactory/libs-snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
What is strange is if I get IVY to publish a release as opposed to a SNAPSHOT into the libs-release-local repository of Artifactory, all resolves as you'd expect. Also, if I specify the unique timestamp as part of the dependency version (the substiute of SNAPSHOT), it also resolves it. So this shows that the Maven projects are able to resolve against Artifactory, just that something is going amiss with SNAPSHOT versions.
I've dug around high and low with little hope on this issue. If you can provide any insight, that'll be highly appreciated.
<artifact name="donaldduck" ext="pom" type="pom" />
to the inner elements of the<ivy:publish>
target. It is described here: [theholyjava.wordpress.com/2011/01/26/using-ivy-with-pom-xml/] , but I honestly do not understand how this works (curiously, I generate the pom into a subfolder, but do not have to state this subfolder in the<artifact
> element) – Mechanic