How to clean Heroku dependency cache (unmanaged maven dependencies)

后端 未结 4 1463
我在风中等你
我在风中等你 2021-02-05 15:01


I have to use an unmanaged SNAPSHOT dependency in my java/maven heroku app. I do this using a project-local maven repository as desribed in this article.

Heroku c

相关标签:
4条回答
  • 2021-02-05 15:20

    Login to heroko by console, go to the git repository directory of your app, run the following commands and try to push to the heroku git repository again

    $ heroku config:set MAVEN_CUSTOM_GOALS="clean package"
    $ heroku config:set MAVEN_CUSTOM_OPTS="--update-snapshots -DskipTests=true"
    

    Now, it will download the latest SNAPSHOT from the repository before build. Refer this heroku build pack for java for more details.

    You can also configure a custom settings.xml for your maven, refer this heroku documentation.

    0 讨论(0)
  • 2021-02-05 15:35

    This doesn't answer the question directly, but if you're having the same issue with Clojure project (using Leiningen), there's a better way to handle this than purging cache with each build: use :update :always property for the repository you're working with. (https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L91)

    :repositories [["releases" {:url "http://blueant.com/archiva/internal"
                                ;; How often should this repository be checked for
                                ;; snapshot updates? (:daily, :always, or :never)
                                :update :always}]]
    
    0 讨论(0)
  • 2021-02-05 15:38

    There's a branch of the java buildpack that clears maven cache. To use it, configure your app to use the cache_clear branch:

    heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-java.git#cache_clear

    ===Update===

    There's a plugin that clears cache on any app. Install it and run the purge-cache command.

    $ heroku plugins:install https://github.com/heroku/heroku-repo.git

    $ heroku repo:purge_cache -a appname

    0 讨论(0)
  • 2021-02-05 15:39

    I've written plugin with an alternate take: bundling the container + the war image into a git repository base image (for now, its either winstone and/or jetty) which is pushed to Heroku, thus maving easier to deploy (I think) :]

    http://cedarhero.ingenieux.com.br/heroku-maven-plugin/

    0 讨论(0)
提交回复
热议问题