如何通过gradle命令生成jar

时间:2019-06-10 02:35:13

标签: java gradle build jar gradlew

美好的一天,

我有一个gradle项目,该项目是由已经离开的资深人士开发的。

当前该项目有一些更改,现在我想向客户端提供最新的jar,但是,当我要生成此jar时,我遇到了一些问题。

这是build.gradle代码:

buildscript {
    ext {
        springBootVersion = '1.3.8.RELEASE'
        poiVersion = '3.15'
        springVersion = '3.0.4.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
    configurations {
        compile.exclude module: "spring-boot-starter-tomcat"
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'

jar {
    baseName = 'c.c.i.converter.statement'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.6
targetCompatibility = 1.6

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


dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile("org.springframework.boot:spring-boot-starter-undertow")
    compile("org.springframework.boot:spring-boot-starter-jdbc")
    compile("org.apache.poi:poi:$poiVersion")
    compile("org.apache.poi:poi-ooxml:$poiVersion")
    compile("org.springframework.batch:spring-batch-infrastructure:$springVersion")
    compile("commons-fileupload:commons-fileupload:1.2")
    compile("org.apache.commons:commons-io:1.3.2")

    compile name: 'db2jcc'
    compile name: 'db2jcc_license_cu'

    testCompile('org.springframework.boot:spring-boot-starter-test')
}

processResources {
    exclude('application-db.properties')
}

我尝试了以下命令,但仍然失败:

./gradlew
./gradlew build

这是我得到的错误:

失败:构建失败,并出现异常。

* What went wrong:
A problem occurred configuring root project 'c.c.i.converter.statement'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.3.8.RELEASE.
     Required by:
         :com.cv.ibs.converter.epayment:unspecified
      > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.3.8.RELEASE.
         > Could not get resource 'https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.3.8.RELEASE/spring-boot-gradle-plugin-1.3.8.RELEASE.pom'.
            > Could not HEAD 'https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.3.8.RELEASE/spring-boot-gradle-plugin-1.3.8.RELEASE.pom'.
               > Received fatal alert: protocol_version

请告知。

0 个答案:

没有答案