ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirby Files <>
Subject Re: ivy:publish build error
Date Thu, 15 Sep 2011 13:52:07 GMT
zharvey wrote on 09/15/2011 09:29 AM:
> Hi Kirby,
> Thanks for getting back to me so quickly.
> Here's my settings file (ivy-settings.xml):
> ===============================
> <ivysettings>
> 	<properties file=""/>
>      <settings defaultResolver="defResolver"/>
>      <latest-strategies>
>      	<latest-lexico/>
>      </latest-strategies>
>      <resolvers>
>          <chain name="defResolver" returnFirst="true">
>           	<url name="jarServer">
> 				<ivy
> pattern="[organisation]/[module]-[revision]-ivy.xml"/>
> 				<artifact
> pattern="[organisation]/[artifact]-[revision].[ext]"/>
>           	</url>
>          </chain>
>      </resolvers>

You only have url resolvers defined here. You cannot really publish to 
those. You need to publish to a resolver you can write to: filesystem, 
sftp, webdav via common-vfs, etc.

>      <modules>
>      	<module organisation="myOrg" name="*" resolver="defResolver"/>
>      </modules>

If you have a defaultResolver defined, as you do above, you don't need 
to do explicit module mapping to a resolver.

>      <publications defaultconf="publish">
> 		<artifact name="MyModule" />
> 	</publications>

You're going to publish your artifacts to a configuration named 
publish, so any modules depending on MyModule will need to have a 
confMapping of compile->publish. Is that what you want? I typically 
publish artifacts to configurations based upon how they will be used 
by the consuming project. So jars needed for running an app will be in 
the "runtime" configuration, while jars only needed for building will 
be published to the "compile" configuration, etc. I also defined 
javadocs and sources configurations.

> 	<!-- Ivy "publish" task; publish the distribution to SVN for downstream
> projects -->
> 	<target name="publish">
> 		<ivy:publish organisation="myOrg" module="MyModule" resolver="defResolver"
> revision="1.0">
> 			<artifacts pattern="dist/[artifact]-[revision].[ext]"/>
> 		</ivy:publish>
> 	</target>
> </project>

So there's your problem. The publish target needs to depend on the 
resolve target, which needs to depend on the settings target.

The settings task should only ever be run once during an ant build, so 
I guard against executing twice (say resolve->settings and 
deliver->settings are both executed in the same build):

     <target name="ivysettings" unless="ivysettings.completed">
         <property name="ivysettings.completed" value="true" />
         <ivy:settings id="ivy.instance"

You'll also want to publish to a resolver to which you can write. I 
generally would not add the artifacts child element (use publications 
in ivy.xml instead); use artifactspattern to define where to find the 
jars specified in <publications>. Unless you have multiple modules per 
buildfile, I wouldn't use the org or module attributes, either. You 
should probably specify a pubrevision and status.

Here's an example from one of my projects:

     <target name="publish_only"
             description="--&gt; publish this project in the prod ivy 
         <property name="revision" value="${version}" />
                      update="true" />
         <echo message="project ${} released with 
version ${revision}" />

Kirby Files
Software Architect
Masergy Communications

View raw message