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 "Bailey, Darragh" <db...@hp.com> on 2010/10/18 18:52:39 UTC
Problem getting a publish to local filesystem working
I'm running into a problem with performing a local publish:
Currently using Ivy 2.2.x-local-20100609212354
Resolver used for local publishing.
<filesystem name="local" local="true">
<ivy pattern="${dest.repo.dir}/[organisation]/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="${dest.repo.dir}/[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]" />
<!-- <artifact pattern="${dest.repo.dir}/[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" /> -->
</filesystem>
This works:
<ivy:publish artifactspattern="${dist.dir}/[artifact]-[revision].[ext]"
conf="*(public)"
pubrevision="${project.version.main}"
resolver="local"
status="integration"
forcedeliver="true"
/>
:: delivering :: org.my#my-module#trunk;working@my-build-machine :: 1.0.1 :: integration :: Mon Oct 18 17:14:11 IST 2010
delivering ivy file to /build/user/me/my/module/dir/trunk/dist/ivy-1.0.1.xml
:: publishing :: org.my#my-module
published my-module to /home/me/.ivyrepo/org.my/my-module/1.0.1.part/jars/my-module-1.0.1.jar
published ivy to /home/me/.ivyrepo/org.my/my-module/1.0.1.part/ivy-1.0.1.xml
publish commited: moved /home/me/.ivyrepo/org.my/my-module/1.0.1.part
to /home/me/.ivyrepo/org.my/my-module/1.0.1
This doesn't:
<ivy:publish artifactspattern="${dist.dir}/[artifact]-[revision].[ext]"
conf="*(public)"
revision="${project.version.main}"
pubrevision="${project.version.full}"
resolver="local"
status="integration"
forcedeliver="true"
/>
BUILD FAILED
[ivy:publish] :: delivering :: org.my#my-module#trunk;1.0.1 :: 1.0.1-1 :: integration :: Mon Oct 18 17:48:14 IST 2010
/build/user/me/my/module/dir/trunk/build.xml:162: org.my#my-module#trunk;1.0.1: java.lang.IllegalStateException: ivy file not found in cache for org.my#my-module#trunk;1.0.1: please resolve dependencies before delivering (/home/me/.ivy2/cache/resolved-org.my-my-module-1.0.1.xml)
at org.apache.ivy.core.deliver.DeliverEngine.deliver(DeliverEngine.java:112)
at org.apache.ivy.Ivy.deliver(Ivy.java:586)
Property values used for versions:
project.version.main = 1.0.1
project.version.full = 1.0.1-1
The jar file built looks like ${dist.dir}/my-module-1.0.1.jar but I would like the ability to publish it as my-module-1.0.1-1.jar in certain cases.
For local publishes I don't care so much about being able to add extra version information to identify minor changes i.e. the "-1" part. But it will be useful once I add publishing to a shared repo for automated builds, so I'd like to understand whether it is possible. I assumed from reading the doc reference with the different options revision & pubrevision it would be, but not so sure now.
Tested with the latest 2.2.0 release version as well and same problem exists. I'm sure I'm missing something, I just don't know what.
--
Regards,
Darragh Bailey
RE: Problem getting a publish to local filesystem working
Posted by "Bailey, Darragh" <db...@hp.com>.
> -----Original Message-----
> From: Bailey, Darragh
> Sent: 18 October 2010 17:53
> To: ivy-user@ant.apache.org
> Subject: Problem getting a publish to local filesystem working
<snipage>
> Property values used for versions:
> project.version.main = 1.0.1
> project.version.full = 1.0.1-1
>
> The jar file built looks like ${dist.dir}/my-module-1.0.1.jar
> but I would like the ability to publish it as
> my-module-1.0.1-1.jar in certain cases.
>
> For local publishes I don't care so much about being able to
> add extra version information to identify minor changes i.e.
> the "-1" part. But it will be useful once I add publishing to
> a shared repo for automated builds, so I'd like to understand
> whether it is possible. I assumed from reading the doc
> reference with the different options revision & pubrevision
> it would be, but not so sure now.
>
>
> Tested with the latest 2.2.0 release version as well and same
> problem exists. I'm sure I'm missing something, I just don't
> know what.
>
> --
> Regards,
> Darragh Bailey
By modifying the artifacts pattern and specifying a src ivy pattern I can get it to work, but it doesn't seem like it's the best way to do this.
Substituted in the value for the following 2 properties where used to make it clearer.
> project.version.main = 1.0.1
> project.version.full = 1.0.1-1
<ivy:publish artifactspattern="${dist.dir}/[artifact]-1.0.1.[ext]"
srcivypattern="${dist.dir}/ivy-1.0.1.xml"
conf="*(public)"
pubrevision="1.0.1-1"
resolver="local"
status="integration"
/>
Is this really the only way to publish with a different revision?
I get the feeling I had an incorrect interpretation of how the artifactspattern, revision and pubrevision are intended to work.
I assumed that revision would set the value used for [revision] in srcivypattern and artifactspattern, but that doesn't appear to be true.
Using the following:
<ivy:publish artifactspattern="${dist.dir}/[artifact]-1.0.1.[ext]"
srcivypattern="${dist.dir}/ivy-[revision].xml"
revision="1.0.1"
conf="*(public)"
pubrevision="1.0.1-1"
resolver="local"
status="integration"
overwrite="true"
/>
The ivy file created is dist/ivy-1.0.1-1.xml, I would have expected it to be dist/ivy-1.0.1.xml and then to be uploaded to the repository as dist/ivy-1.0.1-1.xml.
Certainly the documentation would suggest that this is the way it should work:
"revision the revision of the module to publish and also the published revision unless pubrevision is set" to me sayes: the value used for the src patterns, and also for targets if pubrevision is not set.
"pubrevision the revision to use for the publication" to me sayes: used to publish the artifact with a different revision to what is used to locate the file on the local filesystem.
Is my understanding incorrect?
--
Regards,
Darragh Bailey
RE: Problem getting a publish to local filesystem working
Posted by "Bailey, Darragh" <db...@hp.com>.
> -----Original Message-----
> From: Maarten Coene [mailto:maarten_coene@yahoo.com]
> Sent: 21 October 2010 22:30
> To: ivy-user@ant.apache.org
> Subject: Re: Problem getting a publish to local filesystem working
>
> The specified revision is used for calling the ivy:deliver task.
> If you set the revision to 1.0.1, the ivy:deliver task will
> look in your cache
> for a previous resolved job of your the "my-module-1.0.1" module.
> However, you will get an error because Ivy won't find this
> because you did never
> resolve that module before, because your ivy.xml probably
> doesn't contain a
> revision attribute.
>
> To solve your problem maybe you could create your jars
> without a version in the
> filename, so you don't need to include the [revision] any
> longer in your
> artifacts pattern?
>
> regards,
> Maarten
I'd prefer not to, as I use the same dist rule to build the jar files so that the rpm/msi build targets don't need to rename them to include the main version number in the end filename. I could look at changing that in the future.
For the moment I've settled on using "${dist.dir}/[artifact]-${project.version.main}.[ext]", as the pattern to work around this.
I'm guessing that my understanding of how the revision attribute works when coupled with the pubrevision attribute doesn't match how it actually works. I assumed that it was intended to allow you to pick up an artifact that have a particular revision specified (revision) in the filename but then publish it with an entirely different revision (pubrevision) if so desired.
--
Regards,
Darragh Bailey
Re: Problem getting a publish to local filesystem working
Posted by Maarten Coene <ma...@yahoo.com>.
The specified revision is used for calling the ivy:deliver task.
If you set the revision to 1.0.1, the ivy:deliver task will look in your cache
for a previous resolved job of your the "my-module-1.0.1" module.
However, you will get an error because Ivy won't find this because you did never
resolve that module before, because your ivy.xml probably doesn't contain a
revision attribute.
To solve your problem maybe you could create your jars without a version in the
filename, so you don't need to include the [revision] any longer in your
artifacts pattern?
regards,
Maarten
----- Original Message ----
From: "Bailey, Darragh" <db...@hp.com>
To: "ivy-user@ant.apache.org" <iv...@ant.apache.org>
Sent: Mon, October 18, 2010 6:52:39 PM
Subject: Problem getting a publish to local filesystem working
I'm running into a problem with performing a local publish:
Currently using Ivy 2.2.x-local-20100609212354
Resolver used for local publishing.
<filesystem name="local" local="true">
<ivy
pattern="${dest.repo.dir}/[organisation]/[module]/[revision]/ivy-[revision].xml"
/>
<artifact
pattern="${dest.repo.dir}/[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]"
/>
<!-- <artifact
pattern="${dest.repo.dir}/[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
/> -->
</filesystem>
This works:
<ivy:publish artifactspattern="${dist.dir}/[artifact]-[revision].[ext]"
conf="*(public)"
pubrevision="${project.version.main}"
resolver="local"
status="integration"
forcedeliver="true"
/>
:: delivering :: org.my#my-module#trunk;working@my-build-machine :: 1.0.1 ::
integration :: Mon Oct 18 17:14:11 IST 2010
delivering ivy file to
/build/user/me/my/module/dir/trunk/dist/ivy-1.0.1.xml
:: publishing :: org.my#my-module
published my-module to
/home/me/.ivyrepo/org.my/my-module/1.0.1.part/jars/my-module-1.0.1.jar
published ivy to
/home/me/.ivyrepo/org.my/my-module/1.0.1.part/ivy-1.0.1.xml
publish commited: moved /home/me/.ivyrepo/org.my/my-module/1.0.1.part
to /home/me/.ivyrepo/org.my/my-module/1.0.1
This doesn't:
<ivy:publish artifactspattern="${dist.dir}/[artifact]-[revision].[ext]"
conf="*(public)"
revision="${project.version.main}"
pubrevision="${project.version.full}"
resolver="local"
status="integration"
forcedeliver="true"
/>
BUILD FAILED
[ivy:publish] :: delivering :: org.my#my-module#trunk;1.0.1 :: 1.0.1-1 ::
integration :: Mon Oct 18 17:48:14 IST 2010
/build/user/me/my/module/dir/trunk/build.xml:162: org.my#my-module#trunk;1.0.1:
java.lang.IllegalStateException: ivy file not found in cache for
org.my#my-module#trunk;1.0.1: please resolve dependencies before delivering
(/home/me/.ivy2/cache/resolved-org.my-my-module-1.0.1.xml)
at
org.apache.ivy.core.deliver.DeliverEngine.deliver(DeliverEngine.java:112)
at org.apache.ivy.Ivy.deliver(Ivy.java:586)
Property values used for versions:
project.version.main = 1.0.1
project.version.full = 1.0.1-1
The jar file built looks like ${dist.dir}/my-module-1.0.1.jar but I would like
the ability to publish it as my-module-1.0.1-1.jar in certain cases.
For local publishes I don't care so much about being able to add extra version
information to identify minor changes i.e. the "-1" part. But it will be useful
once I add publishing to a shared repo for automated builds, so I'd like to
understand whether it is possible. I assumed from reading the doc reference with
the different options revision & pubrevision it would be, but not so sure now.
Tested with the latest 2.2.0 release version as well and same problem exists.
I'm sure I'm missing something, I just don't know what.
--
Regards,
Darragh Bailey
Problem getting a publish to local filesystem working
Posted by Miroslav ZaƄko <mi...@gmail.com>.
Pretty old post, however maybe I'll help someone...
I found that after running ivy:resolve even when project don't have any
dependencies fixed this problem... After I found this "solution" I even
found a message about it in error log... :)
"ivy file not found in cache for org.my#my-module#trunk;1.0.1: please
resolve dependencies before delivering
(/home/me/.ivy2/cache/resolved-org.my-my-module-1.0.1.xml)"