我创建了一个使用以下build.gradle
文件(Gradle版本为5.4.1)的Spring Boot应用程序:
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'
}
当我尝试使用
./gradlew bootJar
创建JAR并使用以下命令sudo service project start
运行它时,会显示以下错误消息:我已经将符号链接添加到/etc/init.d中的JAR文件,但在启动时仍显示以上错误。我错过了什么?无法重启project.service:找不到单元project.service。