我正在使用IntelliJ和gradle创建一个多模块spring项目,如下所示。 在根文件夹中有以下build.gradle,我在下面进行了以下设置。调用gradle build时,将在build / libs中创建一个jar,但是执行该jar会收到错误消息: **错误:找不到或加载主类com.connect.configuration.ConnectApplication **在不通过以下方式构建而运行应用程序时:gradle bootRun-应用程序正确加载。但是,在构建项目后执行jar文件会产生错误,并且jar输出以下内容:使用
jar -tf myJar.jar
META-INF/
META-INF/MANIFEST.MF
plugins {
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
subprojects {
group = 'com.connect.connect'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.9
targetCompatibility = 1.9
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java-library'
repositories {
jcenter()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'
}
dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:2.1.9.RELEASE")
}
}
}
settings.gradle
include 'connect-common'
include 'connect-ui'
include 'connect-services'
include 'connect-application'
include 'connect-configuration'