Gradle script plugins
Add to your build.gradle
buildscript {
apply from: 'https://raw.githubusercontent.com/SpazioDati/gradle-plugins/master/<name>.deps.gradle', to: buildscript
}
apply from: 'https://raw.githubusercontent.com/SpazioDati/gradle-plugins/master/<name>.gradle'
- add
gitCommit
property by fetching git sha - new task
processDockerfile
that process any file matchingsrc/**/*Dockerfile
with tag replacing and put the processed version inbuild/*Dockerfile
. This task is no executed by default, you have to enable this. If you want you can add this in your build by adding the following
build.finalizedBy processDockerfile
- Configure java 8 and related properties
- add shadow build by default
- process resources with tag replace (like maven)
- new task
addBuildProperties
that create a file<project-name>-build.properties
that contains project version, git sha, timestamp, and, if available, the env variableBUILD_ID
. The file is added to resources that will be included in the jar.
So you can put your Dockerfile in src/
and write something like this:
...
ADD build/libs/myproject-@[email protected] /myproject
ENV MYPROJECT_VERSION "@version@"
CMD exec java -cp /myproject/*jar myproject.Main
It uses and pre-configures the release plugin net.researchgate:gradle-release
- Your develop and master branches are up-to-date (git pull)
- You are on develop branch
- Your git account can push to the repo
gradle release
then you will be asked for the new release version and the new version for the develop branch