I have created a Spring Boot application with the following build.gradle
file (Gradle version 5.4.1):
plugins {
id 'org.springframework.boot' version '2.1.6.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
bootJar {
launchScript()
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: '2.1.6.RELEASE', ext: 'pom'
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.6.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.1.6.RELEASE'
compile group: 'org.springframework', name: 'spring-orm', version: '5.1.7.RELEASE'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.16'
compile group: 'org.hibernate', name: 'hibernate-hikaricp', version: '5.3.10.Final'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
}
When I try creating a JAR using ./gradlew bootJar
and running it using the following command sudo service project start
, the following error message shows up:
Failed to restart project.service: Unit project.service not found.
I have added the symlink to the JAR file in /etc/init.d, still it displays the above error when starting. What am I missing here?