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 caches the dependencies between builds. Unfortunatly Heroku does not notice if the SNAPSHOT Version changes and keeps on using the cached dependency. This leads to compilation errors as I depend on changes in the SNAPSHOT version.
Is there a way to manually or automatically clean this dependency cache?
I found this maven plugin (it does a local build and pushes the resulting artefacts to heroku) but its not really the way I want to do it.
One could argue its a bad practice to use this snapshot dependency in the first place but I think there are other more or less valid reasons for cleaning the cash e.g. leaking storage as the unmanaged dependencies are not even removed if they are deleted from the project local repository.
I appreciate your answer
It only cleans the project. Show activity on this post. Show activity on this post. With the help of Purging local repository dependencies you need to do that.
All you could do, is to delete the . m2 folder and re-build all of your projects and then the folder would automatically build with all the required library.
The Clean Plugin can be called to execute in the command-line without any additional configurations. Like the other plugins, to run the Clean Plugin, you use: mvn clean:clean.
In Maven, you can use Apache Maven Dependency Plugin, goal dependency:purge-local-repository to remove the project dependencies from the local repository, and re-download it again.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With