无法为 gradle 项目创建 JAR 文件

2023-11-21

我想创建一个可以在 AWS 上上传的 jar 文件,但每次运行命令时gradle jar从命令提示符我收到以下错误。

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or -- 
debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

每当我跑步时,我都会得到“构建成功”gradle clean在命令提示符下。这是build.gradle的内容:

buildscript {
ext {
    springBootVersion = '2.0.4.RELEASE'
}
repositories {
    mavenCentral()
    maven {
        url "https://plugins.gradle.org/m2/"
    }
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    classpath "net.ltgt.gradle:gradle-apt-plugin:0.18"
}
}



apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'net.ltgt.apt'

group = 'com.myproject.api'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_1_8


ext {
  lombokVersion = '1.16.20'
  mapstructVersion = '1.2.0.Final'
}

repositories {
    mavenCentral()
    mavenLocal()
    jcenter()
             flatDir {
                dirs 'libs'
        }
    

}

dependencies {

    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-mail')
    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    compile('org.springframework.data:spring-data-jpa')
    compile('io.springfox:springfox-swagger2:2.9.2')
    compile('io.springfox:springfox-swagger-ui:2.9.2')
    compile group: 'commons-io', name: 'commons-io', version: '2.6'
 
    
    compile group: 'org.json', name: 'json', version: '20180813'
    compile files('libs/checksum_2.0.0.jar')

    compileOnly("org.projectlombok:lombok:${lombokVersion}")
    compileOnly("org.mapstruct:mapstruct-jdk8:${mapstructVersion}")
    compileOnly("org.mapstruct:mapstruct-processor:${mapstructVersion}")

    runtime('org.springframework.boot:spring-boot-devtools')
    runtime('mysql:mysql-connector-java')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}


eclipse {
    classpath {
        file.whenMerged { cp ->
            cp.entries.add( new org.gradle.plugins.ide.eclipse.model.SourceFolder('build/generated/source/apt/ma 
   in', null) )
        }
    }
}

我需要添加任何插件吗?提前致谢。请帮忙


打开任务管理器并强制停止Java(TM) Platform SE二进制并删除

C:\Users\{current user}\.gradle\caches\jars-9\jars-9.lock file

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法为 gradle 项目创建 JAR 文件 的相关文章

随机推荐