From: Gustavo Martin Morcuende Date: Sat, 21 Jan 2017 17:34:21 +0000 (+0100) Subject: Using properties for versioning X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=86903d60fbe8bc69f8af8550c118b1442fee4484;p=JavaForFun Using properties for versioning --- diff --git a/SpringJava/Gradle/build.gradle b/SpringJava/Gradle/build.gradle index ba5257d..b0ba2c1 100644 --- a/SpringJava/Gradle/build.gradle +++ b/SpringJava/Gradle/build.gradle @@ -1,4 +1,46 @@ -project.ext.springVersion='4.3.0.RELEASE' +project.ext { + + // Compile dependencies + // Spring + springVersion='4.3.0.RELEASE' + // Spring JPA + springJPAVersion='1.10.2.RELEASE' + // Spring Envers + springDataEnversVersion='1.0.2.RELEASE' + hibernateEnversVersion='5.2.1.Final' + // Hibernate + hibernateValidatorVersion='5.2.4.Final' + hibernateEntityManagerVersion='5.2.1.Final' + // QueryDSL + queryDslAptVersion='4.1.3' + // Liquibase or FlyWay + liquibaseVersion='3.5.3' + flyWayVersion='4.0.3' + // Jackson. + jacksonVersion='2.8.1' + // Validation API. JSR-303 + validationAPIVersion='1.1.0.Final' + + // LOG4J2 dependencies + slf4jVersion='2.7' + log4jCoreVersion='2.7' + jclOverSlf4jVersion='1.7.22' + + // Unit test dependencies + dockerComposeRuleVersion='0.28.1' + mockitoVersion='2.4.1' + junitVersion='4.12' + + // Integration test dependencies + h2DatabaseVersion='1.4.193' + mysqlConnectorVersion='6.0.5' + + // Plugins + queryDslPluginVersion='1.0.7' + dockerComposePluginVersion='0.3.16' + +} + subprojects { apply plugin: 'java' @@ -21,13 +63,13 @@ subprojects { dependencies { // 1/3 Required dependency for log4j 2 with slf4j: binding between log4j2 and slf4j - compile('org.apache.logging.log4j:log4j-slf4j-impl:2.7') + compile("org.apache.logging.log4j:log4j-slf4j-impl:${slf4jVersion}") // 2/3 Required dependency for log4j 2 with slf4j: log4j 2 maven plugin (it is the log4j 2 implementation) - compile('org.apache.logging.log4j:log4j-core:2.7') + compile("org.apache.logging.log4j:log4j-core:${log4jCoreVersion}") // 3/3 Required dependency for getting rid of commons logging. This is the BRIDGE (no binding) between Jakarta Commons Logging (used by Spring) // and whatever I am using for logging (in this case I am using log4j 2) See: http://www.slf4j.org/legacy.html // We need exclusions in every dependency using Jakarta Commons Logging (see Spring dependencies below) - compile('org.slf4j:jcl-over-slf4j:1.7.22') + compile("org.slf4j:jcl-over-slf4j:${jclOverSlf4jVersion}") compile("org.springframework:spring-context:${springVersion}") { @@ -38,8 +80,8 @@ subprojects { // Unit tests - testCompile('junit:junit:4.12') - testCompile('org.mockito:mockito-core:2.4.1') + testCompile("junit:junit:${junitVersion}") + testCompile("org.mockito:mockito-core:${mockitoVersion}") } diff --git a/SpringJava/Gradle/spring-jpa-persistence/build.gradle b/SpringJava/Gradle/spring-jpa-persistence/build.gradle index 61f1096..747f69c 100644 --- a/SpringJava/Gradle/spring-jpa-persistence/build.gradle +++ b/SpringJava/Gradle/spring-jpa-persistence/build.gradle @@ -1,8 +1,8 @@ buildscript { dependencies { - classpath 'gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7' - classpath 'com.avast.gradle:docker-compose-gradle-plugin:0.3.16' + classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:${queryDslPluginVersion}" + classpath "com.avast.gradle:docker-compose-gradle-plugin:${dockerComposePluginVersion}" } } @@ -13,7 +13,7 @@ dependencies { // Required JPA dependencies with hibernate compile("org.springframework:spring-orm:${springVersion}") - compile('org.springframework.data:spring-data-jpa:1.10.2.RELEASE') { + compile("org.springframework.data:spring-data-jpa:${springJPAVersion}") { exclude group: 'org.springframework', module: 'spring-beans' exclude group: 'org.springframework', module: 'spring-jdbc' exclude group: 'org.springframework', module: 'spring-orm' @@ -22,38 +22,38 @@ dependencies { exclude group: 'org.springframework', module: 'spring-context' exclude group: 'commons-logging', module: 'commons-logging' } - compile('org.hibernate:hibernate-entitymanager:5.2.1.Final') + compile("org.hibernate:hibernate-entitymanager:${hibernateEntityManagerVersion}") // Auditory using Hibernate Envers - compile('org.springframework.data:spring-data-envers:1.0.2.RELEASE') - compile('org.hibernate:hibernate-envers:5.2.1.Final') + compile("org.springframework.data:spring-data-envers:${springDataEnversVersion}") + compile("org.hibernate:hibernate-envers:${hibernateEnversVersion}") // Required by spring-context for using JSR-303. See LocalValidatorFactoryBean // in rest-config.xml - compile('javax.validation:validation-api:1.1.0.Final') - compile('org.hibernate:hibernate-validator:5.2.4.Final') + compile("javax.validation:validation-api:${validationAPIVersion}") + compile("org.hibernate:hibernate-validator:${hibernateValidatorVersion}") // Jackson JSON Processor, required by spring-webmvc. See messageConverters // in rest-config.xml - compile('com.fasterxml.jackson.core:jackson-databind:2.8.1') + compile("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}") // Loading data base in run time either using liquibase - compile('org.liquibase:liquibase-core:3.5.3') + compile("org.liquibase:liquibase-core:${liquibaseVersion}") // or flyway - compile('org.flywaydb:flyway-core:4.0.3') + compile("org.flywaydb:flyway-core:${flyWayVersion}") // Jackson Java time support - compile('com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.1') + compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}") // Using Querydsl - compile('com.querydsl:querydsl-apt:4.1.3') - compile('com.querydsl:querydsl-jpa:4.1.3') + compile("com.querydsl:querydsl-apt:${queryDslAptVersion}") + compile("com.querydsl:querydsl-jpa:${queryDslAptVersion}") // Integration tests @@ -62,9 +62,9 @@ dependencies { } // Either using H2 - testCompile('com.h2database:h2:1.4.193') + testCompile("com.h2database:h2:${h2DatabaseVersion}") // or MYSQL with docker :) - testCompile('mysql:mysql-connector-java:6.0.5') + testCompile("mysql:mysql-connector-java:${mysqlConnectorVersion}") // DockerComposeRule DOES NOT WORK FOR THESE REASONS: // 1. Spring context is loaded before the DockerComposeRule @@ -79,11 +79,11 @@ dependencies { // We will have to run our tests always from the Suite not being able to run // just one Test from the IDE :( // See: AdDescriptionRepositoryDockerComposeRuleShould - testCompile 'com.palantir.docker.compose:docker-compose-rule:0.28.1' + testCompile "com.palantir.docker.compose:docker-compose-rule:${dockerComposeRuleVersion}" } querydsl { - library = 'com.querydsl:querydsl-apt:4.1.3' + library = "com.querydsl:querydsl-apt:${queryDslAptVersion}" querydslSourcesDir = "$buildDir/generated-sources/querydsl" jpa = true }