gpt4 book ai didi

gradle - Gradle + Spring Boot无法处理超过65535个文件的jar

转载 作者:行者123 更新时间:2023-12-03 05:59:53 29 4
gpt4 key购买 nike

使用zip64 true不会创建可用的jar文件。尽管Manifest.mf的文件,结构和位置与以前的工作版本完全相同,但它无法在该jar内找到主类。

真正的问题是:我不需要在最终版本中使用声纳尔或加特林(那些与测试相关),但是AFAIK无法排除插件。

“fatJar”任务用于创建jar。

任何帮助都将受到高度赞赏。

plugins {
id "org.sonarqube" version "2.2.1"
id "com.github.lkishalmi.gatling" version "0.4.1"
}

// Run in terminal with "gradle sonarqube"
sonarqube {
properties {
property "sonar.projectName", "asd"
property "sonar.projectKey", "org.sonarqube:java-gradle-simple"
property "sonar.host.url", "http://asd"
property "sonar.login", "asd"
property "sonar.password", "asd"
}
}

// Run in terminal with "gradle gatlingrun", start the application before.
gatling {
logLevel 'ERROR'
simulations = {
include "**/LoginAndSync.scala"
}
}

group 'asd'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

task fatJar(type: Jar) {
//zip64 true
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'application.Asd'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}

dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.4.1.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.4.1.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '1.4.1.RELEASE'
compile group: 'org.springframework', name: 'spring-orm', version: '4.3.3.RELEASE'
compile group: 'mysql', name: 'mysql-connector-java', version: '6.0.5'
compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.80'
compile group: 'io.gatling.highcharts', name: 'gatling-charts-highcharts', version: '2.2.3'

testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.4.1.RELEASE'
testCompile group: 'com.h2database', name: 'h2', version: '1.4.193'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.springframework.security', name: 'spring-security-test', version: '4.0.0.RELEASE'
}

这是我得到的异常:
xecution failed for task ':fatJar'.
> archive contains more than 65535 entries.

To build this archive, please enable the zip64 extension.
See: https://docs.gradle.org/3.3/dsl/org.gradle.api.tasks.bundling.Zip.html#org.gradle.api.tasks.bundling.Zip:zip64

最佳答案

感谢M.Deinum,我做了一个新的方法:

我在build.gradle中添加了spring-boot作为插件

plugins {
id 'org.springframework.boot' version '1.5.1.RELEASE'
}

现在可以只在控制台中使用 gradle build来获取正在运行的jar,可以在 ./build/libs/中找到它。

关于gradle - Gradle + Spring Boot无法处理超过65535个文件的jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42384941/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com