build.gradle
中添加
repositories {
mavenLocal()
mavenCentral()
}
例子: build.gradle
中添加
compile ('org.springframework.boot:spring-boot-starter-groovy-templates:1.3.3.RELEASE') {
exclude module: 'groovy'
exclude module: 'groovy-templates'
exclude module: 'groovy-xml'
}
例子: build.gradle
中添加
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
}
}
configure(allprojects) {
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
}
如此,就可以使用optional
、provided
形式的依赖了。
dependencies {
testCompile 'junit:junit:4.11'
provided 'org.slf4j:slf4j-api:1.7.13'
optional 'org.springframework.boot:spring-boot-configuration-processor:1.3.3.RELEASE'
}
build.gradle
中添加
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.compilerArgs << '-Xlint:deprecation'
}
}
build.gradle
中添加
sourceCompatibility = 1.8
targetCompatibility = 1.8
build.gradle
中添加
compileJava.options.encoding = 'UTF-8'
build.gradle
中添加
apply plugin: 'groovy'
sourceSets {
main {
java { srcDirs = [] }
groovy { srcDirs = ['src/main/java', 'src/main/groovy'] }
}
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.5'
}
build.gradle
中添加
task runHelloWorld(type: JavaExec, dependsOn: 'classes') {
main = 'com.github.yingzhuo.gradle.example.HelloWorld'
classpath = sourceSets.main.runtimeClasspath
args 'we are command line arguments'
systemProperty ('sys.prop.key', 'sys.prop.value')
}
build.gradle
中添加
task sourcesJar(type: Jar, dependsOn: 'classes') {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: 'javadoc') {
classifier = 'javadoc'
from javadoc['destinationDir']
}
artifacts {
archives sourcesJar
archives javadocJar
}
build.gradle
中添加
springBoot {
mainClass = 'com.mycompany.myapp.pkg.Application'
}