Files
spring-boot/spring-boot-tools/spring-boot-gradle-plugin/build.gradle
Andy Wilkinson f0b7e7cf56 Ensure that fat jars and wars do not corrupt UTF-8 entry names
Previously, both Repackager and the Grade plugin used the JRE's
standard ZipOutputStream when creating a fat jar or war file. This
resulted in entry names that needed UTF-8 encoding to become
corrupted.

This commit updates both to use Commons Compress'
ZipArchiveOutputStream and to configure the stream's encoding and
each entry's Unix mode. This ensures that names are encoded using
UTF-8 and can be read back in correctly by common zip tools.

Closes gh-9405
2017-06-22 11:45:10 -07:00

84 lines
1.6 KiB
Groovy

plugins {
id 'java'
id 'eclipse'
id 'org.sonarqube' version '2.2.1'
}
repositories {
mavenLocal()
mavenCentral()
}
def addDependency(configurationName, dependency) {
def coordinates = [
'group': dependency.groupId.text(),
'name': dependency.artifactId.text(),
'version': dependency.version.text()
]
dependencies {
add configurationName, coordinates
}
}
def effectivePomFile = file('target/effective-pom.xml')
if (effectivePomFile.file) {
def pom = new XmlSlurper().parseText(file('target/effective-pom.xml').text)
pom.dependencies.dependency.each { dependency ->
def scope = dependency.scope.text()
if (scope == 'compile') {
addDependency scope, dependency
}
else if (scope == 'test') {
addDependency 'testCompile', dependency
}
}
}
dependencies {
compile localGroovy()
compile gradleApi()
testCompile gradleTestKit()
}
jar {
manifest {
attributes 'Implementation-Version': (version ? version : 'unknown')
}
}
eclipseJdt {
inputFile = rootProject.file('../../eclipse/org.eclipse.jdt.core.prefs')
doLast {
project.file('.settings/org.eclipse.jdt.ui.prefs').withWriter { writer ->
writer << file('../../eclipse/org.eclipse.jdt.ui.prefs').text
}
}
}
javadoc {
options {
author()
stylesheetFile = file('src/main/javadoc/spring-javadoc.css')
links = [
'http://docs.oracle.com/javase/8/docs/api/',
'https://docs.gradle.org/current/javadoc/'
]
}
title = "${project.description} $version API"
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = "javadoc"
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}