ivy cleancache but specific folders

与世无争的帅哥 提交于 2019-12-13 04:23:54

问题


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


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/17302119/ivy-cleancache-but-specific-folders

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!