ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Troy Self" <>
Subject RE: Publishing 3rd party libraries to local repo
Date Tue, 06 Oct 2009 16:08:14 GMT
I got things working. I'm going to answer my own question for anyone else that happens upon
this. My problems were with my ivy.xml file and my ivy:publish ant task. Corrections in-line:

> Here is an example where I am trying to publish the slf4j-log4j12 library:
> -------------------
> ivy.xml
> -------------------
> <ivy-module version="2.0" xmlns:xsi="
> instance"
> xsi:noNamespaceSchemaLocation="">
>   <info
>     organisation="slf4j"
>     module="slf4j-log4j12"
>     status="release">

Remove the 'status' attribute from the ivy.xml file. This gets added by ivy:deliver.

>   </info>
>   <configurations>
>     <conf name="default"
>       description="Provides this module and its runtime deps."
>       visibility="public" />
>   </configurations>
>   <publications>
>     <artifact name="slf4j-log4j" />

The publications element is unnecessary if you are publishing a single jar w/ the same name
as the module. Otherwise, you can specify specific publications as follows:
  <artifact /> <!-- shortcut for name same as module, type=jar, ext=jar -->
  <artifact type="dll" ext="dll" conf="*" />

What I did there was define 2 artifacts. One is a jar file and the other is a dll. They are
both assumed to be named the same as the module. Otherwise you can specify a name attribute
for each artifact.

>   </publications>
>   <dependencies>
>     <dependency conf="*->default" org="slf4j" name="slf4j-api" rev="1.5.8"
> />
>     <dependency conf="*->default" org="log4j" name="log4j"
> rev="latest.version" />
>   </dependencies>
> </ivy-module>
> -----------------
> build.xml: publish
> -----------------
> <target name="publish" description="publish this module to ${to.resolver}">
>     <ivy:resolve />
>     <ivy:publish organisation="slf4j" module="slf4j-log4j12"
> resolver="${to.resolver}" revision="1.5.8">
>       <artifacts pattern="jars/[artifact].[ext]" />
>     </ivy:publish>
>   </target>

Change the revision attribute to pubrevision. Then change the artifact pattern to "[type]/[artifact].[ext]".
I then changed my directories so that the jar file is in the 'jar' directory and the dll is
in the 'dll' directory.

With this setup, Ivy will create a 'published' version of your ivy.xml that replaces dynamic
version numbers with real version numbers. It is going to drop it in the first artifact directory
it uses. You can also specify the attribute 'srcivypattern' to put it somewhere explicitly
(e.g. "ivy/ivy.xml"). That keeps it separate where it is easy to delete as part of your 'ant
clean' task.

Thanks for the earlier help, since it led me in the right direction to figuring this out.
If I get a convenient script written that makes it easy to quickly publish 3rd party libraries,
I'll pass it along.

-- tBs

View raw message