You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by todd lee <To...@amis.com> on 2007/05/01 22:05:48 UTC

Ivy Publish module with no dependencies

Hi there, 
We use a local enterprise repository for our build system in which
everything is home grown (nothing public). 
I've been trying to find an easy way to publish some legacy artifacts to the
repository so that they're available for other, more complex projects which
depend on them. I guess what we're trying to accomplish is essentially the
same as an ivy:install task, only there's no 'from' repository/resolver -
the artifact is just sitting in the base directory beside the ant build.xml.

The artifacts that we want to publish don't have any other dependencies,
just source. I was thinking that I could use a straightforward ivy:publish
to achieve what I want to do in a generic ant script (we want to automate
their publication as required) and an ivy.xml template that gets all it's
info from a property file depending on the artifact to publish. 

Problem is, it keeps complaining that I should do a resolve before
publishing. I'm sure there's got to be an easy solution to this, but perhaps
I'm missing it. Relatively new to ivy. Suggestions are greatly appreciated!

Thanks
Todd
-- 
View this message in context: http://www.nabble.com/Ivy-Publish-module-with-no-dependencies-tf3676987.html#a10275095
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Ivy Publish module with no dependencies

Posted by todd lee <To...@amis.com>.


todd lee wrote:
> 
> 
> 
> Xavier Hanin wrote:
>> 
>> Publish is the right way to go, the only problem is that publish
>> automatically calls deliver if you don't provide the ivy.xml to
>> publish, which in turns calls resolve. But if you really provide the
>> ivy file (using srcivypattern), publish shouldn't try to call a
>> resolve. If you still do not succeed, please send us more details
>> about your task call and your build environment.
>> 
> 
> Thanks Xavier - but looks like I'm still running into a problem. It's
> complaining that ivy.organisation is not set...
> Here's the highlevel project setup:
> 
> four files sitting in basedir: build.xml, ivy.xml, component.properties,
> artifact.bin
> build.xml loads component.properties
> build.xml has 'publish' target which depends on 'configure' and performs
> an ivy:publish.
> 
> Here's some code snippets for more detail:
> 
> <snip build.xml>
> ...  
>     <!-- ================================= 
>           target: publish        
>          ================================= -->   
>     <target name="publish" depends="configure" description="-->
> publication of the project artifats">  
> 
>         <ivy:info file="${ivy.project.dir}/ivy.xml" />
> 
>         <ivy:publish
>                 resolver="${ivy.resolver}"
>                 srcivypattern="${ivy.project.dir}/ivy.xml" >
>                 <artifacts pattern="${ivy.project.dir}/[artifact].[ext]"
> />
>         </ivy:publish>
>     </target>
> ...
> 
> </snip build.xml>
> 
> <snip ivy.xml>
> ... 
>     <info organisation="${component.organisation}"
> module="${component.module}"  revision="${ivy.deliver.revision}"/>
> ...
> </snip ivy.xml>
> 
> 

Thanks for the help Xavier - shortly after I posted the previous I found
that calling ivy:info before my publish fixed the problem with missing ivy
properties. I added the task as above and that left me with one issue - ivy
complained that it had a bad revision in the ivy.xml (wanted me to use
forcedeliver or update), presumably because I wasn't explicitly providing a
revision in the 'info' section of the ivy.xml. After explicitly adding the
revision as "${ivy.deliver.revision}" (as above) everything seems to be
working fine - Thanks again!

Todd
-- 
View this message in context: http://www.nabble.com/Ivy-Publish-module-with-no-dependencies-tf3676987.html#a10305929
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Ivy Publish module with no dependencies

Posted by Xavier Hanin <xa...@gmail.com>.
Hi,

Not enough time to give it more analyze now, but what you can try is
to call the info task before calling publish. But you will run into a
problem with your properties, because when you provide an ivy file to
publish it publishes it as is. I think in your case you should better
use an ant filter to replace the properties before calling publish,
instead of relying on Ivy.

Keep us informed of your progress, if it's still not working I'll try
to find time to test based on your snippets.

Xavier

On 5/3/07, todd lee <To...@amis.com> wrote:
>
>
>
> Xavier Hanin wrote:
> >
> > Publish is the right way to go, the only problem is that publish
> > automatically calls deliver if you don't provide the ivy.xml to
> > publish, which in turns calls resolve. But if you really provide the
> > ivy file (using srcivypattern), publish shouldn't try to call a
> > resolve. If you still do not succeed, please send us more details
> > about your task call and your build environment.
> >
>
> Thanks Xavier - but looks like I'm still running into a problem. It's
> complaining that ivy.organisation is not set...
> Here's the highlevel project setup:
>
> four files sitting in basedir: build.xml, ivy.xml, component.properties,
> artifact.bin
> build.xml loads component.properties
> build.xml has 'publish' target which depends on 'configure' and performs an
> ivy:publish.
>
> Here's some code snippets for more detail:
>
> <snip build.xml>
> ...
>     <!-- ====================================================
>          Ivy specific common properties:
>          ==================================================== -->
>         <property name="ivy.resolver" value="local-repository" />
>
>         <property name="ivy.conf.dir" value="C:/autobuild_root/ivy" />
>         <property name="ivy.repo.dir"
> value="${ivy.conf.dir}/local-repository" />
>
>         <property name="ivy.project.dir" value="${basedir}" />
>         <property name="ivy.overwrite.repo" value="false" />
> ...
>
>     <!-- =================================
>           target: init_publish
>          ================================= -->
>     <target name="init_publish" description="--> initializing the autobuild
> script" >
>         <!-- read in component properties for ivy modules if they exist-->
>         <property file="${ivy.project.dir}/component.properties" />
>     </target>
>
>     <!-- =================================
>           target: configure
>          ================================= -->
>     <target name="configure" depends="init_publish" description="-->
> configure Ivy for use">
>         <ivy:configure file="${ivy.conf.dir}/ivyconf.xml"/>
>
>     </target>
>
>     <!-- =================================
>           target: publish
>          ================================= -->
>     <target name="publish" depends="configure" description="--> publication
> of the project artifats">
>         <ivy:publish
>                 resolver="${ivy.resolver}"
>                 srcivypattern="${ivy.project.dir}/ivy.xml" >
>                 <artifacts pattern="${ivy.project.dir}/[artifact].[ext]" />
>         </ivy:publish>
>     </target>
> ...
>
> </snip build.xml>
>
> <snip component.properties>
>  component.organisation=myOrg
>  component.module=myMod
>  component.artifact=artifact
>  component.type=bin
>  component.ext=bin
> </snip component.properties>
>
> <snip ivy.xml>
> ...
>     <info organisation="${component.organisation}"
> module="${component.module}" />
>     <publications>
>        <artifact name="${component.artifact}" type="${component.type}"
> ext="${component.ext}"/>
>     </publications>
>
>     <dependencies/>
>
>     <conflicts>
>             <manager name="latest-revision"/>
>     </conflicts
> ...
> </snip ivy.xml>
>
> So as I understand it, ivy should use the local ivy.xml with the properties
> substituted in ivy.xml to publish the local artifact - right? I'm not sure
> why it's complaining about organisation not being set etc... help is much
> appreciated.
>
> Todd
> --
> View this message in context: http://www.nabble.com/Ivy-Publish-module-with-no-dependencies-tf3676987.html#a10305527
> Sent from the ivy-user mailing list archive at Nabble.com.
>
>


-- 
Learn Ivy at ApacheCon: http://www.eu.apachecon.com/
Manage your dependencies with Ivy!
http://incubator.apache.org/ivy/

Re: Ivy Publish module with no dependencies

Posted by todd lee <To...@amis.com>.


Xavier Hanin wrote:
> 
> Publish is the right way to go, the only problem is that publish
> automatically calls deliver if you don't provide the ivy.xml to
> publish, which in turns calls resolve. But if you really provide the
> ivy file (using srcivypattern), publish shouldn't try to call a
> resolve. If you still do not succeed, please send us more details
> about your task call and your build environment.
> 

Thanks Xavier - but looks like I'm still running into a problem. It's
complaining that ivy.organisation is not set...
Here's the highlevel project setup:

four files sitting in basedir: build.xml, ivy.xml, component.properties,
artifact.bin
build.xml loads component.properties
build.xml has 'publish' target which depends on 'configure' and performs an
ivy:publish.

Here's some code snippets for more detail:

<snip build.xml>
...
    <!-- ==================================================== 
         Ivy specific common properties: 
         ==================================================== -->
        <property name="ivy.resolver" value="local-repository" />
        
        <property name="ivy.conf.dir" value="C:/autobuild_root/ivy" />
        <property name="ivy.repo.dir"
value="${ivy.conf.dir}/local-repository" />

        <property name="ivy.project.dir" value="${basedir}" />
        <property name="ivy.overwrite.repo" value="false" />
...

    <!-- ================================= 
          target: init_publish      
         ================================= -->
    <target name="init_publish" description="--> initializing the autobuild
script" >
        <!-- read in component properties for ivy modules if they exist-->
        <property file="${ivy.project.dir}/component.properties" />
    </target>

    <!-- ================================= 
          target: configure              
         ================================= -->
    <target name="configure" depends="init_publish" description="-->
configure Ivy for use">
        <ivy:configure file="${ivy.conf.dir}/ivyconf.xml"/>

    </target>
    
    <!-- ================================= 
          target: publish        
         ================================= -->   
    <target name="publish" depends="configure" description="--> publication
of the project artifats">  
        <ivy:publish
                resolver="${ivy.resolver}"
                srcivypattern="${ivy.project.dir}/ivy.xml" >
                <artifacts pattern="${ivy.project.dir}/[artifact].[ext]" />
        </ivy:publish>
    </target>
...

</snip build.xml>

<snip component.properties>
 component.organisation=myOrg
 component.module=myMod
 component.artifact=artifact
 component.type=bin
 component.ext=bin
</snip component.properties>

<snip ivy.xml>
... 
    <info organisation="${component.organisation}"
module="${component.module}" />
    <publications>
       <artifact name="${component.artifact}" type="${component.type}"
ext="${component.ext}"/>
    </publications>

    <dependencies/>

    <conflicts>
            <manager name="latest-revision"/>
    </conflicts
...
</snip ivy.xml>

So as I understand it, ivy should use the local ivy.xml with the properties
substituted in ivy.xml to publish the local artifact - right? I'm not sure
why it's complaining about organisation not being set etc... help is much
appreciated.

Todd
-- 
View this message in context: http://www.nabble.com/Ivy-Publish-module-with-no-dependencies-tf3676987.html#a10305527
Sent from the ivy-user mailing list archive at Nabble.com.


Re: Ivy Publish module with no dependencies

Posted by Xavier Hanin <xa...@gmail.com>.
On 5/1/07, todd lee <To...@amis.com> wrote:
>
> Hi there,
> We use a local enterprise repository for our build system in which
> everything is home grown (nothing public).
> I've been trying to find an easy way to publish some legacy artifacts to the
> repository so that they're available for other, more complex projects which
> depend on them. I guess what we're trying to accomplish is essentially the
> same as an ivy:install task, only there's no 'from' repository/resolver -
> the artifact is just sitting in the base directory beside the ant build.xml.
>
> The artifacts that we want to publish don't have any other dependencies,
> just source. I was thinking that I could use a straightforward ivy:publish
> to achieve what I want to do in a generic ant script (we want to automate
> their publication as required) and an ivy.xml template that gets all it's
> info from a property file depending on the artifact to publish.
>
> Problem is, it keeps complaining that I should do a resolve before
> publishing. I'm sure there's got to be an easy solution to this, but perhaps
> I'm missing it. Relatively new to ivy. Suggestions are greatly appreciated!
Publish is the right way to go, the only problem is that publish
automatically calls deliver if you don't provide the ivy.xml to
publish, which in turns calls resolve. But if you really provide the
ivy file (using srcivypattern), publish shouldn't try to call a
resolve. If you still do not succeed, please send us more details
about your task call and your build environment.

HTH,

Xavier

>
> Thanks
> Todd
> --
> View this message in context: http://www.nabble.com/Ivy-Publish-module-with-no-dependencies-tf3676987.html#a10275095
> Sent from the ivy-user mailing list archive at Nabble.com.
>
>


-- 
Learn Ivy at ApacheCon: http://www.eu.apachecon.com/
Manage your dependencies with Ivy!
http://incubator.apache.org/ivy/