0

I thought ivy:info task would do the job by...

<ivy:info file="${local_ivy_file}"/>
<ivy:info organisation="${ivy.organisation}" module="${ivy.module}" revision="${ivy.revision}" property="check"/>

But even when the artifact does not exist on the repo, the properties of "check" (check.organisation, check.module, check.revision) always returns the same values as that of ivy.organisation, etc... when the expected values of "check" properties should be null (since they don't exist on repo)

Am I missing something?

Why this is needed:

I have a large set of third party jars to upload, but i do not have admin rights to overwrite (and should not overwrite) if file exists.

Doing

<ivy:publish overwrite="false"/>

will break the entire process whereas I need the task to continue cycle through the whole set of jars/ivy.xml.

Thanks

Scott Chang
  • 301
  • 4
  • 11
  • If you're looking for the next free version number in a published sequence then you need to use the ivy buildnumber task, see: http://ant.apache.org/ivy/history/latest-milestone/use/buildnumber.html – Mark O'Connor Dec 10 '15 at 02:22
  • i'm not looking for the next free version number, i simply want to skip the publish of the version already exists, and continue on publish the rest. – Scott Chang Dec 10 '15 at 23:19
  • Ivy is not designed to do this, while it's a great dependency management client it sucks as a repository manager. I would suggest you script your requirement, ivy can easily adapt to whatever file directory structure you choose to store files into. Alternatively (and perhaps better in the long run) use one of the standard Maven repository managers: Nexus, Artifactory or Achiva – Mark O'Connor Dec 11 '15 at 07:32

1 Answers1

0

i found my problem. my original method does work, except that i have to remove the ivy cache before running the info task, since ivy looks in the cache before looking in the repo.

<delete dir="${ivy_cache_path}"/>
<ivy:info file="${local_ivy_file}"/>
<ivy:info organisation="${ivy.organisation}" module="${ivy.module}" revision="${ivy.revision}" property="check"/>

now ${check.revision} correctly captures the revision of the artifact in the source ivy file if the artifact exists in the online repo, and has no value if it does not exist. I can use this as a condition for the subsequent tasks.

Scott Chang
  • 301
  • 4
  • 11