ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edwin Castro <0ptikGh...@gmx.us>
Subject Publishing modules with configurations
Date Wed, 28 Aug 2013 22:50:17 GMT
We have a project that produces jars in this form: env.module_name.jar.
These jars are currently copied to the target environment filtered by
environment name and finally renamed so that the final jar on the target
is just module_name.jar. For example, dev.module_name.jar gets deployed
on the dev environment as module_name.jar.

It seemed to me that I could create a configuration for each environment
and then resolve/retrieve by configuration instead of jumping through
the renaming hoops we currently do.

Here's the test configuration I'm trying to use:

<!-- ivysettings.xml -->
<ivysettings>
    <credentials realm="Artifactory Realm"
                 host="localhost"
                 username="admin"
                 passwd="password"/>
    <caches defaultCacheDir="${basedir}/build/ivy_cache"
           
ivyPattern="[organisation]/[module]/[revision]/[type]s/[conf].[artifact].[ext]"
           
artifactPattern="[organisation]/[module]/[revision]/[type]s/[conf].[artifact].[ext]"/>
    <resolvers>
        <url name="default" m2compatible="false">
            <ivy
pattern="http://localhost:8082/artifactory/libs-snapshot-local/[organisation]/[module]/[revision]/[type]s/[conf].[artifact].[ext]"/>
            <artifact
pattern="http://localhost:8082/artifactory/libs-snapshot-local/[organisation]/[module]/[revision]/[type]s/[conf].[artifact].[ext]"/>
        </url>
    </resolvers>
</ivysettings>

<!-- ivy.xml -->
<ivy-module version="2.0">
    <info organisation="org.example"
          module="module_example"/>
    <configurations>
        <conf name="dev"/>
        <conf name="tst"/>
        <conf name="prd"/>
    </configurations>
    <publications>
        <artifact conf="dev"/>
        <artifact conf="tst"/>
        <artifact conf="prd"/>
    </publications>
</ivy-module>

<!-- build.xml -->
<project name="module_example" basedir="."
         xmlns:ivy="antlib:org.apache.ivy.ant">
    <taskdef uri="antlib:org.apache.ivy.ant"
             resource="org/apache/ivy/ant/antlib.xml">
        <classpath>
            <pathelement location="ivy-2.3.0.jar"/>
        </classpath>
    </taskdef>

    <ivy:resolve/>
    <ivy:publish resolver="default"
                 overwrite="true"
                 update="true"
                 forcedeliver="true"
                 pubrevision="0">
        <artifacts pattern="build/lib/[conf].[artifact].[ext]"/>
    </ivy:publish>
</project>

When I run ant I get:

BUILD FAILED
/Users/egcastro/dev/conf_test/build.xml:16: impossible to publish
artifacts for org.example#module_example;working@poseidon:
java.io.IOException: missing artifact
org.example#module_example;0!module_example.jar
    at
org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:219)
    at
org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:166)
    at org.apache.ivy.Ivy.publish(Ivy.java:615)
    at org.apache.ivy.ant.IvyPublish.doExecute(IvyPublish.java:312)
    at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
    at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
    at org.apache.tools.ant.Main.runBuild(Main.java:826)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Clearly I've misconfigured something but I'm not sure what what to look
at next. What am I doing wrong?

--
Edwin G. Castro


Mime
View raw message