Skip to content

Instantly share code, notes, and snippets.

@zcmgyu
Forked from rponte/build.gradle
Created May 7, 2018 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zcmgyu/65abdb5c1fbdc9610f3da9e0faaafd40 to your computer and use it in GitHub Desktop.
Save zcmgyu/65abdb5c1fbdc9610f3da9e0faaafd40 to your computer and use it in GitHub Desktop.
Configuring Gradle compiler encoding
apply plugin: 'java'
apply plugin: 'eclipse'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
eclipseJdt << {
ant.propertyfile(file: ".settings/org.eclipse.core.resources.prefs") {
ant.entry(key: "eclipse.preferences.version", value: "1")
ant.entry(key: "encoding/<project>", value: "utf-8")
}
}
/**
* 1st approach: Setting encoding during compilation in Java and Test classes
*/
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
/**
* 2nd approach: Setting encoding during compilation in Java and Test classes
*
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Test) {
systemProperty "file.encoding", "UTF-8"
}
*/
repositories {
jcenter()
maven {
url "https://oss.sonatype.org/content/groups/public/"
}
}
def springVersion = "4.3.2.RELEASE"
def dbunitVersion = "2.5.1"
dependencies {
/**
* Dependências das classes de produção
*/
compile "org.slf4j:slf4j-api:1.7.21"
compile "org.slf4j:jul-to-slf4j:1.7.21"
compile "org.slf4j:jcl-over-slf4j:1.7.21"
compile "org.slf4j:slf4j-log4j12:1.7.21"
/**
* Spring
*/
compile "org.springframework:spring-core:${springVersion}"
compile "org.springframework:spring-context:${springVersion}"
compile "org.springframework:spring-tx:${springVersion}"
compile "org.springframework:spring-jdbc:${springVersion}"
/**
* Dependências dos testes automatizados
*/
testCompile "junit:junit:4.12"
testCompile "org.dbunit:dbunit:${dbunitVersion}"
testCompile "br.com.triadworks:dbunitmanager:1.0.1-SNAPSHOT"
testCompile "org.springframework:spring-test:${springVersion}"
/**
* Dependências fixas
*/
compile fileTree(dir: "lib/oracle", include: '*.jar')
}
task wrapper(type: Wrapper) {
description = "Generates gradlew[.bat] scripts"
gradleVersion = "2.14.1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment