Shweta
Shweta

Reputation: 922

ivy cleancache but specific folders

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

Upvotes: 0

Views: 3526

Answers (2)

Shweta
Shweta

Reputation: 922

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.

Upvotes: 0

Nicolas Lalev&#233;e
Nicolas Lalev&#233;e

Reputation: 2013

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" />

Upvotes: 2

Related Questions