Skip to content

Instantly share code, notes, and snippets.

@sidneydemoraes
Created April 27, 2017 18:58
Show Gist options
  • Save sidneydemoraes/ab1ada8ae36b8c374b7b9c082ee1c739 to your computer and use it in GitHub Desktop.
Save sidneydemoraes/ab1ada8ae36b8c374b7b9c082ee1c739 to your computer and use it in GitHub Desktop.
TechTalk - Gradle + SpringBoot + Groovy - build.gradle
group 'br.com.smc'
version '0.0.1-SNAPSHOT'
buildscript {
ext {
springBootVersion = '1.5.2.RELEASE'
}
repositories {
/*maven {
url("http://inforep01.ogmaster.local:8080/nexus/content/groups/public/")
}*/
maven { url 'http://repo.spring.io/plugins-release' }
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
}
}
/* BASIC PLUGINS FOR SPRING BOOT WITH GROOVY ON INTELLIJ */
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'propdeps'
apply plugin: 'propdeps-idea'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
/* Nexus DA EMPRESA PARA QUANDO EU TOCAR O PROJETO DE LA
maven {
url("http://inforep01.ogmaster.local:8080/nexus/content/groups/public/")
}*/
mavenLocal()
mavenCentral()
maven {
url("https://artifacts.alfresco.com/nexus/content/repositories/public/")
}
}
ext['thymeleaf.version'] = '3.0.2.RELEASE'
ext['thymeleaf-layout-dialect.version'] = '2.1.1'
dependencies {
/* SPRING BOOT MAIN DEPENDENCY */
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-devtools")
optional("org.springframework.boot:spring-boot-configuration-processor")
/* AUTHENTICATION FRAMEWORKS */
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.social:spring-social-security")
compile("org.springframework.social:spring-social-config")
compile("org.springframework.social:spring-social-facebook:3.0.0.M1")
/* GROOVY SUPPORT */
compile("org.codehaus.groovy:groovy")
/* VIEW LAYER WITH THYMELEAF */
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.thymeleaf.extras:thymeleaf-extras-springsecurity4:3.0.0.RELEASE")
/* SERVIÇO DE EMAIL */
compile("org.springframework.boot:spring-boot-starter-mail")
/* PERSISTENCE */
compile("org.springframework.boot:spring-boot-starter-data-jpa")
/* TESTING FRAMEWORKS */
testCompile("junit:junit")
testCompile("org.spockframework:spock-spring")
testCompile("org.springframework:spring-test")
}
compileJava.dependsOn(processResources)
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(bootRun)) {
println 'Ambiente de desenvolvimento detectado.'
apply from: project.file("config-gradle/env-dev.gradle")
} else {
println 'Ambiente integrado detectado.'
apply from: project.file("config-gradle/env-real.gradle")
}
}
task wrapper(type: Wrapper) {
gradleVersion = '3.4'
}
task bootRunLocalDb(type: org.springframework.boot.gradle.run.BootRunTask, dependsOn: 'build') {
group = 'Application'
doFirst() {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
systemProperty 'spring.profiles.active', 'local'
}
}
task bootRunRemote(type: org.springframework.boot.gradle.run.BootRunTask, dependsOn: 'build') {
group = 'Application'
doFirst(){
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
systemProperty 'spring.profiles.active', 'remote'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment