ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulo Santos" <paulinho.san...@gmail.com>
Subject Re: java.lang.IllegalStateException: ivy file not found in cache
Date Tue, 16 Sep 2008 23:18:04 GMT
Hello Xavier,

I didn't get your last question. Do you mean, if when I publish I set the
artifactspattern to the same directory where my original ivy file is? If it
is that, no; they are in different folders.

I solved the problem, but not in a good way. As you can see below, I used
the prefix attribute at the ivy:buildnumber task. By changing the prefix of
the properties the ivy.revision was not overwritten anymore.

  <target name="ivy-new-version" unless="ivy.new.revision">
        <!-- default module version prefix value -->
        <property name="module.version.prefix"
value="${marketing.version.target}-${version.classifier}" />

        <!-- asks to ivy an available version number -->
        <ivy:info file="${ivy.file}" />
        <ivy:buildnumber
            organisation="${ivy.organisation}" module="${ivy.module}"
            revision="${module.version.prefix}"
prefix="myproject"defaultBuildNumber="1" revSep=""/>
    </target>

    <target name="version" depends="ivy-new-version">
        <!-- create version file in classpath for later inclusion in jar -->
        <echo  message="version=${myproject.new.revision}"file="${dist.root}/${
ant.project.name}.properties" append="false" />
        <!-- load generated version properties file -->
        <property file="${dist.root}/${ant.project.name}.properties" />
    </target>


    <!-- =================================
          target: publish
         ================================= -->
    <target name="publish" depends="super-pack, version" description="-->
publish this project in the shared repository">
        <ivy:publish artifactspattern="${dist.root}/[artifact].[ext]"
                        resolver="ivysvn"
                        pubrevision="${myproject.new.revision}"
                        status="release"
                        forcedeliver="true"
        />
        <echo message="project ${ant.project.name} released with version
${myproject.new.revision}" />
    </target>

What bugs me is that this is a workaround, and I really can't tell how this
ivy.revision ended up overwritten, since I have a almost identical project
where everything works. And one thing that I didn't understand is the this
part from debug log of a successful build!

Overriding previous definition of property
"ivy.revision"                            // Ok, so the ivy.revision will be
overwritten?
Setting project property: ivy.revision -> 1.0-dev-b2
                                   // It will be not possible to find the
resolve-xxx.xml anymore!
Setting project property: ivy.new.revision -> 1.0-dev-b3
Setting project property: ivy.build.number -> 2
Setting project property: ivy.new.build.number -> 3
version:
 [property] Loading
/home/deco/workspace/ProjectBar/build/classes/ProjectBar.properties
Setting project property: version -> 1.0-dev-b3
publish-no-test:
Overriding previous definition of property "ivy.version"
Setting project property: ivy.version -> 2.0.0-rc1-local-20080915151600
[ivy:publish] parameter found as ivy variable:
ivy.organisation=info.projects
[ivy:publish] parameter found as ivy variable: ivy.module=ProjectBar
[ivy:publish] parameter found as ivy variable: ivy.revision=working@deco-vm
        // Was not overwritten?? How??
[ivy:publish] parameter not found: ivy.deliver.branch
[ivy:publish] parameter found as attribute value:
ivy.deliver.revision=1.0-dev-b3
[ivy:publish] parameter found as attribute value: ivy.status=release


and because of that, the build is sucessful!!!

Paulo



On Tue, Sep 16, 2008 at 10:15 AM, Xavier Hanin <xavier.hanin@gmail.com>wrote:

> Mmm, I'm not sure what's going wrong, but as you pointed it's a problem
> with
> the value of ivy.revision variable. The value of this variable should come
> from the info/@revision value in your ivy file, and defaults to
> working@<hostname>
> when none is provided. But for a publish to fail with the exception you
> have, it's probably because the value of this attribute changes between
> your
> call to resolve (which actually generates the resolved-xxx.xml file in your
> cache) and your call to publish. Maybe you do a deliver directly on the ivy
> file used to resolve?
> Xavier
>
> On Mon, Sep 15, 2008 at 6:41 PM, Paulo Santos <paulinho.santos@gmail.com
> >wrote:
>
> > Just adding some more information,
> >
> > the first time I run ProjectFoo, it works because ivy places my Host Name
> > as
> > the ivy.revision attribute, thus fiding the "
> > resolved-info.projects-ProjectFoo-working@deco-vm.xml", the second time
> I
> > run, Ivy places as the ivy.revision attribute the value 1.0-alpha1,
> > consequently looking for
> > /home/deco/.ivy2/cache/resolved-info.projects-ProjectFoo-1.0-alpha1.xml,
> > obviously not finding (the file in cache is the one in red above).
> >
> > Here the first run (,successful):
> >
> > ================ Log with -debug ===============
> >
> > riding previous definition of property "ivy.version"
> > Setting project property: ivy.version -> 2.0.0-rc1-local-20080915151600
> > [ivy:publish] parameter found as attribute value:
> > ivy.organisation=info.projects
> > [ivy:publish] parameter found as attribute value: ivy.module=ProjectFoo
> > [ivy:publish] parameter found as attribute value:
> > ivy.revision=working@deco-vm     * // First time it uses the Host Name*
> > [ivy:publish] parameter not found: ivy.deliver.branch
> > [ivy:publish] parameter found as attribute value:
> > ivy.deliver.revision=1.0-alpha1
> > [ivy:publish] parameter found as attribute value:
> >
> >
> ivy.deliver.ivy.pattern=/home/deco/workspace/ProjectFoo/dist/[artifact].[ext]
> > [ivy:publish] parameter found as attribute value: ivy.status=release
> > [ivy:publish] parameter not found: ivy.delivery.list.file
> >   +Task: property
> >  [property] Loading /tmp/delivery.properties
> >  [property] Unable to find property file: /tmp/delivery.properties
> > :: delivering :: info.projects#ProjectFoo;working@deco-vm :: 1.0-alpha1
> ::
> > release :: Mon Sep 15 16:14:15 GMT 2008
> >    delivering ivy file to /home/deco/workspace/ProjectFoo/dist/ivy.xml
> > :: publishing :: info.projects#ProjectFoo
> > Publishing from
> /home/deco/workspace/ProjectFoo/dist/project-foo-linux.zip
> > to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/zips/project-foo-linux.zip
> > Added folder: r1954 by 'ivy' at Mon Sep 15 16:12:34 GMT 2008
> > Added folder: r1955 by 'ivy' at Mon Sep 15 16:12:35 GMT 2008
> > Publishing from /tmp/ivytemp64349sha1 to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/zips/project-foo-linux.zip.sha1
> > Publishing from /tmp/ivytemp64351md5 to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/zips/project-foo-linux.zip.md5
> >    published project-foo-linux to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/zips/project-foo-linux.zip
> > Publishing from
> > /home/deco/workspace/ProjectFoo/dist/project-foo-windows.zip
> > to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/zips/project-foo-windows.zip
> > Publishing from /tmp/ivytemp64354sha1 to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/zips/project-foo-windows.zip.sha1
> > Publishing from /tmp/ivytemp64356md5 to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/zips/project-foo-windows.zip.md5
> >    published project-foo-windows to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/zips/project-foo-windows.zip
> > Publishing from /home/deco/workspace/ProjectFoo/dist/ivy.xml to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/ivys/ivy.xml
> > Added folder: r1962 by 'ivy' at Mon Sep 15 16:12:48 GMT 2008
> > Publishing from /tmp/ivytemp64359sha1 to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/ivys/ivy.xml.sha1
> > Publishing from /tmp/ivytemp64361md5 to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/ivys/ivy.xml.md5
> >    published ivy to
> >
> >
> https://195.227.0.189/svn/deco/shared/info.projects/ProjectFoo/1.0-alpha1/ivys/ivy.xml
> >     [echo] project Project - Foo - Release released with version
> 1.0-alpha1
> >   [antcall] Exiting /home/deco/workspace/ProjectFoo/build.xml.
> > BUILD SUCCESSFUL
> > Total time: 1 minute 4 seconds
> >
> > On Fri, Sep 12, 2008 at 4:28 PM, Paulo Santos <paulinho.santos@gmail.com
> > >wrote:
> >
> > > Hello all,
> > >
> > > I'm having trouble with ivy files in cache. Ivy looks for an ivy file
> in
> > > cache with the pattern
> "resolved-<organisation>-<module>-<revision>.xml"
> > > when publishing.
> > >
> > > Now, data from two projects, ProjectBar works, while ProjectFoo
> doesn't.
> > >
> > > In the successful project (ProjectBar), publishing finds the file. Here
> > is
> > > the debug output:
> > >
> > >         Overriding previous definition of property "ivy.revision"
> > >         Setting project property: ivy.revision -> 1.0-dev-b4
> > //
> > > Current version
> > >         Setting project property: ivy.new.revision -> 1.0-dev-b5
> >  //
> > > New version
> > >         Setting project property: ivy.build.number -> 4
> > >         Setting project property: ivy.new.build.number -> 5
> > >         version:
> > >          [property] Loading
> > > /home/deco/workspace/ProjectBar/build/classes/ProjectBar.properties
> > >         Setting project property: version -> 1.0-dev-b5
> > >         publish-no-test:
> > >         [ivy:publish] parameter found as ivy variable:
> > > ivy.organisation=info.projects
> > >         [ivy:publish] parameter found as ivy variable:
> > > ivy.module=ProjectBar
> > >         [ivy:publish] parameter found as ivy variable:
> > > ivy.revision=working@deco-vm        // Hey!! How is my host name as
> the
> > > old revision???
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.deliver.revision=1.0-dev-b5
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.status=release
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.organisation=info.projects
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.module=ProjectBar
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.revision=working@deco-vm        // Really don't get it!
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.deliver.revision=1.0-dev-b5
> > >         [ivy:publish] parameter found as attribute value:
> > >
> >
> ivy.deliver.ivy.pattern=/home/deco/workspace/ProjectBar/dist/[artifact].[ext]
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.status=release
> > >         [ivy:publish] parameter not found: ivy.delivery.list.file
> > >            +Task: property
> > >          [property] Loading /tmp/delivery.properties
> > >          [property] Unable to find property file:
> > /tmp/delivery.properties
> > >         [ivy:publish] :: delivering ::
> > > info.projects#ProjectBar;working@deco-vm :: 1.0-dev-b5 :: release ::
> Thu
> > > Sep 11 16:15:23 GMT 2008
> > >         [ivy:publish]     options = status=release pubdate=Thu Sep 11
> > > 16:15:23 GMT 2008 validate=true resolveDynamicRevisions=true
> > resolveId=null
> > >
> > >         ...
> > >
> > > Ok, really didn't quite understand, but actually works because all ivy
> > > files with the 'resolved' prefix that are written to my cache, have as
> > >     revision my host name "working@deco-vm"; so ivy is able to find
> the
> > > file "resolved-info.projects-ProjectBar-working@deco-vm.xml".
> > >
> > > In the second project (ProjectFoo) ivy doesn't find the file, here the
> > > debug output:
> > >
> > >         Overriding previous definition of property "ivy.revision"
> > >         Setting project property: ivy.revision -> 1.0-alpha1
> >  //
> > > OK, current version
> > >         Setting project property: ivy.new.revision -> 1.0-alpha2
> >  //
> > > New version, so far so good.
> > >         Setting project property: ivy.build.number -> 1
> > >         Setting project property: ivy.new.build.number -> 2
> > >         version:
> > >          [property] Loading
> > > /home/deco/workspace/ProjectFoo/dist/ProjectFoo.properties
> > >         Setting project property: version -> 1.0-alpha2
> > >         publish:
> > >              [echo] /home/deco/workspace/ProjectFoo/dist
> > >         [ivy:publish] parameter found as ivy variable:
> > > ivy.organisation=info.projects
> > >         [ivy:publish] parameter found as ivy variable:
> > > ivy.module=ProjectFoo
> > >         [ivy:publish] parameter found as ivy variable:
> > > ivy.revision=1.0-alpha1            // Uau!!! Where is the 'trick' with
> > the
> > > Host Name
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.deliver.revision=1.0-alpha2
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.status=release
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.organisation=info.projects
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.module=ProjectFoo
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.revision=1.0-alpha1        // actually found the right version.
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.deliver.revision=1.0-alpha2
> > >         [ivy:publish] parameter found as attribute value:
> > >
> >
> ivy.deliver.ivy.pattern=/home/deco/workspace/ProjectFoo/dist/[artifact].[ext]
> > >         [ivy:publish] parameter found as attribute value:
> > > ivy.status=release
> > >         [ivy:publish] parameter not found: ivy.delivery.list.file
> > >            +Task: property
> > >          [property] Loading /tmp/delivery.properties
> > >          [property] Unable to find property file:
> > /tmp/delivery.properties
> > >         [ivy:publish] :: delivering ::
> > info.projects#ProjectFoo;1.0-alpha1
> > > :: 1.0-alpha2 :: release :: Thu Sep 11 16:41:00 GMT 2008
> > >         [ivy:publish]     options = status=release pubdate=Thu Sep 11
> > > 16:41:00 GMT 2008 validate=true resolveDynamicRevisions=true
> > resolveId=null
> > >           [antcall] Exiting /home/deco/workspace/ProjectFoo/build.xml.
> > >
> > >         BUILD FAILED
> > >         /home/deco/workspace/ProjectFoo/build.xml:51: The following
> error
> > > occurred while executing this line:
> > >         /home/deco/workspace/Release/release.xml:59: impossible to
> > publish
> > > artifacts for info.projects#ProjectFoo;1.0-alpha1:
> > > info.projects#ProjectFoo;1.0-alpha1: java.lang.IllegalStateException:
> ivy
> > > file not found in cache for info.projects#ProjectFoo;1.0-alpha1: please
> > > resolve dependencies before delivering
> > >
> (/home/deco/.ivy2/cache/resolved-info.projects-ProjectFoo-1.0-alpha1.xml)
> > >             at
> > >
> >
> org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:541)
> > >             at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
> > >             at
> > > org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
> > >             at
> > > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> > >             at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown
> > Source)
> > >             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:105)
> > >             at org.apache.tools.ant.Task.perform(Task.java:348)
> > >             at org.apache.tools.ant.Target.execute(Target.java:357)
> > >             at
> org.apache.tools.ant.Target.performTasks(Target.java:385)
> > >             at
> > > org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> > >             at
> > > org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> > >             at
> > >
> >
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> > >             at
> > >
> >
> org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
> > >             at
> > > org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> > >             at
> > >
> >
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
> > >             at
> > >
> >
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
> > >         Caused by: /home/deco/workspace/Release/release.xml:59:
> > impossible
> > > to publish artifacts for info.projects#ProjectFoo;1.0-alpha1:
> > >     info.projects#ProjectFoo;1.0-alpha1:
> > >             java.lang.IllegalStateException: ivy file not found in
> cache
> > > for info.projects#ProjectFoo;1.0-alpha1: please resolve dependencies
> > before
> > > delivering (
> > >
> /home/deco/.ivy2/cache/resolved-info.projects-ProjectFoo-1.0-alpha1.xml)
> > >
> > >             // Unfortunately, the file in cache is '
> > > resolved-info.projects-ProjectFoo-working@deco-vm.xml' and ivy is
> > looking
> > > for 'resolved-info.projects-ProjectFoo-1.0-alpha1.xml'.
> > >
> > >
> > > Can anyone tell, what am I doing wrong, or if this is actually a bug?
> > >
> > > Thanks,
> > >
> > > Paulo
> > >
> > >
> > > Below are the "version" and "publish" targets for both projects
> > > ==============================================================
> > > ======================    ProjectFoo    ===============================
> > > ==============================================================
> > >     <target name="ivy-new-version" unless="ivy.new.revision">
> > >         <!-- default module version prefix value -->
> > >         <property name="module.version.prefix"
> > > value="${marketing.version.target}-${version.classifier}" />
> > >
> > >         <!-- asks to ivy an available version number -->
> > >         <ivy:info file="${ivy.file}" />
> > >         <ivy:buildnumber
> > >             organisation="${ivy.organisation}" module="${ivy.module}"
> > >             revision="${module.version.prefix}" defaultBuildNumber="1"
> > > revSep=""/>
> > >     </target>
> > >
> > >     <target name="version" depends="ivy-new-version">
> > >         <!-- create version file in classpath for later inclusion in
> jar
> > > -->
> > >         <mkdir dir="${dist.root}"/>
> > >         <echo  message="version=${ivy.new.revision}"
> > file="${dist.root}/${
> > > ant.project.name}.properties" append="false" />
> > >         <!-- load generated version properties file -->
> > >         <property file="${dist.root}/${ant.project.name}.properties"
> />
> > >     </target>
> > >
> > >
> > >     <target name="publish" depends="version" description="--> publish
> > this
> > > project in the shared repository">
> > >         <ivy:publish artifactspattern="${dist.root}/[artifact].[ext]"
> > >                            resolver="ivysvn"
> > >                            pubrevision="${version}"
> > >                            status="release"
> > >                            forcedeliver="true"
> > >         />
> > >         <echo message="project ${ant.project.name} released with
> version
> > > ${version}" />
> > >     </target>
> > > ==============================================================
> > > ======================    /ProjectFoo    ==============================
> > > ==============================================================
> > >
> > > ==============================================================
> > > ======================    ProjectBar   ===============================
> > > ==============================================================
> > >     <target name="ivy-new-version" unless="ivy.new.revision">
> > >         <!-- default module version prefix value -->
> > >         <property name="module.version.prefix"
> > > value="${module.version.target}-dev-b" />
> > >
> > >         <!-- asks to ivy an available version number -->
> > >         <ivy:info file="${ivy.file}" />
> > >         <ivy:buildnumber
> > >             organisation="${ivy.organisation}" module="${ivy.module}"
> > >             revision="${module.version.prefix}" defaultBuildNumber="1"
> > > revSep=""/>
> > >     </target>
> > >
> > >     <target name="version" depends="ivy-new-version">
> > >         <!-- create version file in classpath for later inclusion in
> jar
> > > -->
> > >         <!--   <mkdir dir="${build.classes}"/>-->
> > >         <echo  message="version=${ivy.new.revision}"
> > > file="${build.classes}/${ant.project.name}.properties" append="false"
> />
> > >         <!-- load generated version properties file -->
> > >         <property file="${build.classes}/${ant.project.name
> }.properties"
> > > />
> > >     </target>
> > >
> > >       <target name="publish-no-test" depends="jar, version"
> > > description="--> publish this project in the shared repository">
> > >             <ivy:publish
> artifactspattern="${dist.root}/[artifact].[ext]"
> > >                                resolver="ivysvn"
> > >                                pubrevision="${version}"
> > >                                status="release"
> > >             />
> > >             <echo message="project ${ant.project.name} released with
> > > version ${version}" />
> > >         </target>
> > > ==============================================================
> > > ======================    /ProjectBar    ==============================
> > > ==============================================================
> > >
> >
>
>
>
> --
> Xavier Hanin - Independent Java Consultant
> BordeauxJUG co leader - http://www.bordeauxjug.org/
> Blogger - http://xhab.blogspot.com/
> Apache Ivy Creator - http://ant.apache.org/ivy/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message