Generate service file in build time.
NOTE this project is not real plugin of gradle
Use winsw for windows, systemd for linux
Just apply it in spring boot project
project(':some-spring-boot') {
apply plugin: 'java'
apply from: 'https://raw.githubusercontent.com/xiaoyao9184/spring-boot-service-gradle-plugin/master/gradle/services.gradle'
}
Just use variable.
gradle.properties
serviceLanguage=zh_CN
serviceTemplateGit=http://www.like-gitlab.com/yourname/spring-boot-service-gradle-plugin/raw/master
build.gradle
project(':some-spring-boot') {
apply plugin: 'java'
apply from: "${serviceTemplateGit}/gradle/services.gradle"
}
By default, the templates in this repository will be downloaded to the '.service' directory of project for generating service config files.
If the template file is already in the '.service' folder, the local file will be used first.
default template for window winsw winsw exe
default template for window systemd
You can use the following variables in the template.
- version
- service
- project
- rootProject
project and rootProject variables are gradle model
version form "${version}"
service include
systemd only
- rootName: form
project.overrideRootName
orrootProject.name
- systemdBuildDir: is
${service.buildDir}/systemd-service/${service.profile}
winsw only
- netVersion: is
net4
- winswVersion: is
2.3.0
- winswBuildDir:
${service.buildDir}/winsw-service/${service.profile}
all
- profile: form
project.profile
- language: form
project.serviceLanguage
default isen_US
- downloadUrl: form
project.serviceTemplateGit
default ishttps://raw.githubusercontent.com/xiaoyao9184/spring-boot-service-gradle-plugin/master
- templateDir: is
${rootProject.rootDir}/.service
- buildDir: is
${project.buildDir}/services