diff --git a/build.gradle b/build.gradle index 8e179dca80f..5bedb38e464 100644 --- a/build.gradle +++ b/build.gradle @@ -2,21 +2,19 @@ import org.apache.tools.ant.filters.ReplaceTokens buildscript { repositories { + maven { url "https://repo.grails.org/grails/core" } jcenter() } dependencies { classpath "commons-io:commons-io:2.2" classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1" + classpath "com.netflix.nebula:gradle-extra-configurations-plugin:2.2.0" classpath "com.github.adrianbk:gradle-travisci-trigger-plugin:1.0.0" } } apply plugin: 'idea' -ext.optionalDeps = [] -ext.providedDeps = [] - -ext.provided = { providedDeps << it } ext { bintrayPublish = false grailsVersion = '3.0.0.BUILD-SNAPSHOT' @@ -51,6 +49,7 @@ ext { cglibVersion = "2.2.2" objenesisVersion = "1.4" tomcatVersion = "7.0.55" + servletApiVersion = "3.0.1" isJava8Compatible = org.gradle.api.JavaVersion.current().isJava8Compatible() } @@ -152,11 +151,28 @@ subprojects { project -> apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'project-report' + apply plugin: 'provided-base' + apply plugin: 'optional-base' sourceCompatibility = "1.7" targetCompatibility = "1.7" + if(project.name =~ /^(grails-web|grails-plugin-|grails-project-api|grails-test-suite|grails-test)/) { + dependencies { + provided "javax.servlet:javax.servlet-api:$servletApiVersion" + // MockHttpServletRequest/Response/Context used in many classes + provided("org.springframework:spring-test:${springVersion}") { + exclude group: 'commons-logging', module:'commons-logging' + } + } + } + if(project.name =~ /^(grails-plugin-datasource|grails-test-suite)/) { + dependencies { + provided 'hsqldb:hsqldb:1.8.0.10' + provided 'com.h2database:h2:1.3.176' + } + } jar{ manifest.mainAttributes( @@ -340,20 +356,6 @@ subprojects { project -> pom.withXml { def xml = asNode() - // respect 'optional' and 'provided' dependencies - optionalDeps.each { dep -> - xml.dependencies.find { it.artifactId == dep.name }?.optional = true - } - providedDeps.each { dep -> - xml.dependencies.find { it.artifactId == dep.name }?.scope = 'provided' - - } - - configurations.runtime.allDependencies.each { dependency -> - if (dependency.hasProperty("notInPom") && dependency.notInPom) { - xml.dependencies.removeAll { it.groupId == dependency.group && it.artifactId == dependency.name } - } - } xml.children().last() + { delegate.name 'Grails' @@ -374,8 +376,6 @@ subprojects { project -> delegate.developerConnection 'scm:git@github.com:grails/grails-core.git' } - - delegate.developers { delegate.developer { delegate.id 'graemerocher' @@ -386,8 +386,8 @@ subprojects { project -> delegate.name 'Jeff Brown' } delegate.developer { - delegate.id 'burtbeckwith' - delegate.name 'Burt Beckwith' + delegate.id 'lhotari' + delegate.name 'Lari Hotari' } } @@ -478,4 +478,4 @@ tciTrigger { task wrapper(type: Wrapper) { gradleVersion = '2.3' jarFile = 'gradle/wrapper/gradle-wrapper.jar' -} +} \ No newline at end of file diff --git a/grails-core/build.gradle b/grails-core/build.gradle index 84606c98ff6..2b8547198e0 100644 --- a/grails-core/build.gradle +++ b/grails-core/build.gradle @@ -1,6 +1,3 @@ -configurations { - optional -} dependencies { compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final' compile( "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:${concurrentlinkedhashmapVersion}" ) { @@ -19,9 +16,8 @@ dependencies { compile("org.springframework:spring-context:${springVersion}") { exclude group: 'commons-logging', module:'commons-logging' } - compile("org.springframework:spring-test:${springVersion}") { + provided("org.springframework:spring-test:${springVersion}") { exclude group: 'commons-logging', module:'commons-logging' - ext.notInPom = true } // Used by Spring AOP @@ -32,9 +28,7 @@ dependencies { exclude group: 'xml-apis', module:'xml-apis' } - optional ("org.springframework:springloaded:$springLoadedVersion") - - + provided ("org.springframework:springloaded:$springLoadedVersion") compile project(":grails-bootstrap"), { exclude group:"org.fusesource.jansi", module:"jansi" @@ -60,26 +54,16 @@ dependencies { // These dependencies are not required, but due to a Groovy compiler bug they are loaded by Groovy and hence // have to be on the path for compilation even though they shouldn't be - optional "org.apache.ant:ant:${antVersion}" - optional "jline:jline:$jlineVersion" - optional "org.fusesource.jansi:jansi:$jansiVersion" - optional("org.codehaus.gant:gant_groovy1.8:${gantVersion}") { + provided "org.apache.ant:ant:${antVersion}" + provided "jline:jline:$jlineVersion" + provided "org.fusesource.jansi:jansi:$jansiVersion" + provided("org.codehaus.gant:gant_groovy1.8:${gantVersion}") { exclude group:'commons-cli', module:'commons-cli' exclude group:'org.apache.ant', module:'ant' } } -sourceSets { - main { - compileClasspath += files(configurations.optional) - } - test { - compileClasspath += files(configurations.optional) - runtimeClasspath += files(configurations.optional) - } -} -javadoc.classpath += files(configurations.optional) compileGroovy.doFirst { delete("${buildDir}/classes/main/META-INF") ant.mkdir(dir:sourceSets.main.output.classesDir) diff --git a/grails-plugin-async/build.gradle b/grails-plugin-async/build.gradle index 9e56f5428d4..25e6368b1a6 100644 --- a/grails-plugin-async/build.gradle +++ b/grails-plugin-async/build.gradle @@ -1,5 +1,5 @@ dependencies { - compile 'javax.servlet:javax.servlet-api:3.0.1', provided - compile 'javax:javaee-web-api:6.0', provided + provided "javax.servlet:javax.servlet-api:$servletApiVersion" + provided 'javax:javaee-web-api:6.0' compile project(':grails-plugin-controllers'), project(':grails-plugin-events') -} \ No newline at end of file +} diff --git a/grails-plugin-converters/build.gradle b/grails-plugin-converters/build.gradle index ef922a412eb..921ab953844 100644 --- a/grails-plugin-converters/build.gradle +++ b/grails-plugin-converters/build.gradle @@ -3,4 +3,5 @@ dependencies { compile project(":grails-web"), project(':grails-plugin-domain-class') + provided project(":grails-async") } diff --git a/grails-plugin-datasource/build.gradle b/grails-plugin-datasource/build.gradle index 6de9aa78d06..86de82982ec 100644 --- a/grails-plugin-datasource/build.gradle +++ b/grails-plugin-datasource/build.gradle @@ -1,6 +1,3 @@ -configurations { - optional -} dependencies { compile("org.springframework:spring-jdbc:${springVersion}") { exclude group: 'commons-logging', module:'commons-logging' @@ -15,20 +12,5 @@ dependencies { compile "org.apache.tomcat:tomcat-jdbc:$tomcatVersion" runtime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:$tomcatVersion" - optional 'hsqldb:hsqldb:1.8.0.10' - - optional 'com.h2database:h2:1.3.176' - compile project(":grails-core") } - -sourceSets { - main { - compileClasspath += files(configurations.optional) - } - test { - compileClasspath += files(configurations.optional) - runtimeClasspath += files(configurations.optional) - } -} -javadoc.classpath += files(configurations.optional) diff --git a/grails-plugin-domain-class/build.gradle b/grails-plugin-domain-class/build.gradle index ba190fb0f11..4fce04e154e 100644 --- a/grails-plugin-domain-class/build.gradle +++ b/grails-plugin-domain-class/build.gradle @@ -2,9 +2,7 @@ dependencies { compile project(":grails-core"), project(":grails-spring"), project(":grails-validation") - compile project(":grails-async"), { - ext.notInPom = true - } + provided project(":grails-async") // Datastore APIs compile("org.grails:grails-datastore-gorm:$datastoreVersion") { diff --git a/grails-plugin-domain-class/src/main/groovy/org/grails/plugins/domain/DomainClassPluginSupport.groovy b/grails-plugin-domain-class/src/main/groovy/org/grails/plugins/domain/DomainClassPluginSupport.groovy index 38395522a4e..903515c2688 100644 --- a/grails-plugin-domain-class/src/main/groovy/org/grails/plugins/domain/DomainClassPluginSupport.groovy +++ b/grails-plugin-domain-class/src/main/groovy/org/grails/plugins/domain/DomainClassPluginSupport.groovy @@ -34,7 +34,7 @@ class DomainClassPluginSupport { return true } - def constraints = object.constraints + def constraints = object.getConstraints() if (constraints) { for (prop in constraints.values()) { prop.messageSource = ctx.getBean("messageSource") diff --git a/grails-plugin-testing/build.gradle b/grails-plugin-testing/build.gradle index 71700ff83ca..28f36f088c9 100644 --- a/grails-plugin-testing/build.gradle +++ b/grails-plugin-testing/build.gradle @@ -32,6 +32,8 @@ dependencies { } runtime "cglib:cglib:${cglibVersion}" + + provided "org.apache.ant:ant:${antVersion}" } eclipse { @@ -44,4 +46,3 @@ eclipse { } } } - diff --git a/grails-plugin-url-mappings/build.gradle b/grails-plugin-url-mappings/build.gradle index 993915092e1..9c89f3ebf07 100644 --- a/grails-plugin-url-mappings/build.gradle +++ b/grails-plugin-url-mappings/build.gradle @@ -1,6 +1,3 @@ -configurations { - optional -} dependencies { compile "commons-lang:commons-lang:$commonsLangVersion" compile( "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:${concurrentlinkedhashmapVersion}" ) { @@ -8,13 +5,5 @@ dependencies { } compile project(":grails-web"), project(":grails-plugin-controllers"), project(":grails-validation") - optional "junit:junit:${junitVersion}" + provided "junit:junit:${junitVersion}" } -sourceSets { - main { - compileClasspath += files(configurations.optional) - } - test { - runtimeClasspath += files(configurations.optional) - } -} \ No newline at end of file diff --git a/grails-test/build.gradle b/grails-test/build.gradle index ed38e698161..b0a6d3825cd 100644 --- a/grails-test/build.gradle +++ b/grails-test/build.gradle @@ -1,6 +1,3 @@ -configurations { - optional -} dependencies { compile "org.springframework:spring-tx:${springVersion}" @@ -15,37 +12,23 @@ dependencies { compile "junit:junit:${junitVersion}", { exclude group:'org.hamcrest', module: 'hamcrest-core' } - compile("org.spockframework:spock-core:${spockVersion}") { + compile("org.spockframework:spock-core:${spockVersion}") { transitive = false exclude group:'junit', module: 'junit-dep' exclude group:'org.codehaus.groovy', module: 'groovy-all' } - // needed for Spock - compile 'org.objenesis:objenesis:1.4' - compile project(":grails-plugin-converters"), project(":grails-plugin-mimetypes") compile project(":grails-web") // command line requirements - optional "jline:jline:$jlineVersion" - optional "org.fusesource.jansi:jansi:$jansiVersion" + provided "jline:jline:$jlineVersion" + provided "org.fusesource.jansi:jansi:$jansiVersion" // Ant - optional "org.apache.ant:ant:${antVersion}" - optional "org.apache.ant:ant-junit:${antVersion}" + provided "org.apache.ant:ant:${antVersion}" + provided "org.apache.ant:ant-junit:${antVersion}" // needed for Spock compile "org.objenesis:objenesis:${objenesisVersion}" } - -sourceSets { - main { - compileClasspath += files(configurations.optional) - } - test { - compileClasspath += files(configurations.optional) - runtimeClasspath += files(configurations.optional) - } -} -javadoc.classpath += files(configurations.optional) diff --git a/grails-web-common/build.gradle b/grails-web-common/build.gradle index 05d31c31d7c..31939a15550 100644 --- a/grails-web-common/build.gradle +++ b/grails-web-common/build.gradle @@ -7,9 +7,8 @@ dependencies { compile project(":grails-gsp") compile "org.codehaus.groovy:groovy-templates:$groovyVersion" - compile 'javax.servlet:javax.servlet-api:3.0.1', provided compile "org.springframework:spring-webmvc:${springVersion}" compile "org.springframework:spring-context-support:${springVersion}" compile 'com.google.code.gson:gson:2.2.4' -} \ No newline at end of file +} diff --git a/grails-web-gsp/build.gradle b/grails-web-gsp/build.gradle index df2d10fa677..d3a59485f6f 100644 --- a/grails-web-gsp/build.gradle +++ b/grails-web-gsp/build.gradle @@ -1,8 +1,3 @@ -configurations { - optional -} - - dependencies { compile( project(":grails-gsp") ) compile( project(":grails-web-common") ) @@ -16,13 +11,5 @@ dependencies { // } testRuntime( project(":grails-spring") ) - optional "org.apache.ant:ant:${antVersion}" + provided "org.apache.ant:ant:${antVersion}" } - -sourceSets { - main { - compileClasspath += files(configurations.optional) - } -} - -javadoc.classpath += files(configurations.optional) diff --git a/grails-web-url-mappings/build.gradle b/grails-web-url-mappings/build.gradle index aba1a985c72..186c80c7bfa 100644 --- a/grails-web-url-mappings/build.gradle +++ b/grails-web-url-mappings/build.gradle @@ -1,11 +1,7 @@ -configurations { - optional -} dependencies { compile project(":grails-web-common"), project(":grails-validation") - compile 'javax.servlet:javax.servlet-api:3.0.1', provided compile("org.grails:grails-datastore-core:$datastoreVersion") { exclude group: 'org.springframework', module:'spring-core' exclude group: 'org.springframework', module:'spring-context' @@ -30,14 +26,6 @@ dependencies { exclude group: 'commons-logging', module:'commons-logging' } - optional "org.fusesource.jansi:jansi:$jansiVersion" - optional "jline:jline:$jlineVersion" + provided "org.fusesource.jansi:jansi:$jansiVersion" + provided "jline:jline:$jlineVersion" } -sourceSets { - main { - compileClasspath += files(configurations.optional) - } - test { - runtimeClasspath += files(configurations.optional) - } -} \ No newline at end of file