0

We have some internal jars in a remote repository and do not build them very often.The resolver looks like this: view-snapshots is a local repo and hub-releases is a shared repo.

    <chain name="hub-internal-library-chain" returnFirst="true">
        <resolver ref="view-snapshots"/>
        <resolver ref="hub-releases"/>

    </chain>

By default,if a developer publishes anything it goes to view-snapshots cache.We need to keep the flag

return first-"true"

for performance issues.So the issue I want to delete some specific files in cache(local) and repository(local).I am a newbie to ivy,any help will be appreciated.

Thanks

PS: I have already had a look at this question which is similar to mine.But its not solved yet. http://grokbase.com/t/ant/ivy-user/105d2bxpyy/refreshing-ivy-cache-after-changing-a-published-version

Shweta
  • 924
  • 14
  • 23
  • Not clear why you want to delete files from the cache. Why don't you just purge it? Perhaps you need to checkout the "changingPattern" attribute on your resolver. For more information in this space I recommend reading the following: http://ant.apache.org/ivy/history/latest-milestone/concept.html#cache – Mark O'Connor Jun 25 '13 at 20:38

2 Answers2

2

There is no dedicated code in Ivy which delete the entries of only one module in a cache.

But it is quite easy to do with regular Ant tasks. Assuming you have the default cache with the default pattern, here a piece of build.xml which will delete the cache of the module foo of the company com.acme:

<delete dir="${user.home}/.ivy2/cache/com.acme/foo" />
Nicolas Lalevée
  • 2,014
  • 1
  • 15
  • 14
  • 1
    i modified your solution to suit my needs.I just wanted to know if there is anything in ivy that can do it automatically – Shweta Jun 26 '13 at 17:40
0

This the solution that works for me :

  <target name="clear-entries" if="clean-selected-cache" depends="clear-cache,clear-  repository">
    <echo>Clearing cache and repository entries for internal libraries</echo>
   </target>

<target name="clear-cache">
  <delete verbose="true">
    <fileset dir="${ivy.view-local.cache.root}">
      <includesfile name="path.to.file/clear-cache.includes.txt"/>
    </fileset>
   </delete>
</target>

<target name="clear-repository">
  <delete verbose="true">
    <fileset dir="${ivy.view-local.repository.root}">
      <includesfile name="path.to.file/clear-cache.includes.txt"/>
    </fileset>
  </delete>
</target>

You can easily add the specific folder you want to delete from cache and from repository in clear-cache.includes.txt.

Shweta
  • 924
  • 14
  • 23