错误讯息:
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':bootRepackage'. > MALFORMED * Try: Run with --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRepackage'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
...
Caused by: java.lang.IllegalArgumentException: MALFORMED at org.springframework.boot.loader.tools.JarWriter.writeEntries(JarWriter.java:92) at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:144)
设置:
Java版本:
java版本" 1.8.0_31"
Java(TM)SE运行时环境(版本1.8.0_31-b13)
Java HotSpot(TM)64位服务器VM(版本25.31-b07,混合模式)
build.gradle
import org.apache.tools.ant.filters.ReplaceTokens import java.util.Date def profile = "PROD"; buildscript { ext { springBootVersion = '1.0.2.RELEASE' //**have tried with 1.2.4 as well** } repositories { mavenLocal() mavenCentral() maven { url "http://repo.spring.io/release" } maven { url "http://repo.spring.io/milestone" } maven { url "http://repo.spring.io/snapshot" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'spring-boot' mainClassName = "dk.api.gas.Gas" compileJava.options.encoding = 'UTF-8' sourceCompatibility = 1.7 targetCompatibility = 1.7 compileJava.options.encoding = "UTF-8" jar { baseName = 'quotes' version = '1.0.0' } repositories { mavenCentral() maven { url "http://repo.springsource.org/libs-snapshot" } maven {url "http://xxxxx.compute.amazonaws.com/artifactory/gradle/" credentials { username 'xx' password 'xxxx' } } } dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile("org.springframework.boot:spring-boot-starter-aop:${springBootVersion}") compile("com.fasterxml.jackson.core:jackson-databind") compile('dk.mobile:fileStorageLib:1.4.0') { exclude module: 'dk.mobile:common' } compile('dk.mobile:common:2.0.0') compile('dk.mobile:mail:1.0.5') compile('dk.mobile:update:1.1.0') { exclude module: 'dk.mobile:common' } compile('org.apache.solr:solr-solrj:3.1.0') compile('dk.mobile:authentication:1.3.0') { exclude module: 'dk.mobile:common' } compile('com.googlecode.charts4j:charts4j:1.3') compile('org.apache.poi:poi-ooxml:3.12') } def getDate() { def date = new Date() def formattedDate = date.format('dd.MM.yyy - HH:mm:ss') return formattedDate } processResources { filter ReplaceTokens, tokens: ["AppProfile": profile ] } task wrapper(type: Wrapper) { gradleVersion = '1.11' }
答案 0 :(得分:1)
在Windows上构建时遇到了同样的问题。 问题是我有长名称的文件,所以他们的路径超过256个字符并导致压缩崩溃并且bootRepackage失败。
另一方面,在Linux上构建相同的应用程序时没有任何问题。
希望这会有所帮助。
答案 1 :(得分:0)
另一个问题可能是你有非ascii字符的文件。
我们遇到了同样的错误,因为有一些使用德语变音符号的类名(ä
,ö
,ü
)。重命名类后,问题就消失了(在Windows上)。
答案 2 :(得分:0)
我在Windows上构建时遇到了同样的问题。问题是名为recources / statics / images /未命名.png的文件,你不能使用中文字符。