Updated Gradle Now compileGoovy failing with "unable to resolve class" - gradle

This is some of the errors. The XXXX represents personal or confidential information.
/Users/XXXXXXX/Documents/XXXX/XXXX/internal-tools/grails-app/utils/com/XXXXXX/utils/DomainUtils.groovy: 3: unable to resolve class com.XXXXXX.util.DateHelper
# line 3, column 1.
import com.XXXXXXX.util.DateHelper
^
/Users/XXXXXXX/Documents/XXXX/XXXXX/internal-tools/grails-app/utils/com/XXXXXXXX/utils/TemporalUtil.groovy: 4: unable to resolve class com.XXXXXXX.util.DateHelper
# line 4, column 1.
import com.XXXXXXX.util.DateHelper
^
/Users/XXXXXX/Documents/XXXX/XXXX/internal-tools/grails-app/utils/com/XXXXX/utils/TemporalUtil.groovy: 3: unable to resolve class com.XXXXXXX.data.JodaTemporal
# line 3, column 1.
import com.XXXXXXX.data.JodaTemporal
^
851 errors
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':internal-tools:compileGroovy'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:184)
at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:57)
at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:77)
at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:65)
at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerCallable.call(AbstractDaemonCompiler.java:88)
at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerCallable.call(AbstractDaemonCompiler.java:76)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:42)
at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:46)
at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:30)
at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:101)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:155)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:137)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
... 3 more
This is the build.gradle
//
// Basic project info
//
description = 'Root Project Build'
ext {
//
// Boilerplate gradle CM support
//
buildMajorVersion = 195
isWindows = org.gradle.internal.os.OperatingSystem.current().windows
}
// Make library versions are available in all projects
allprojects {
ext {
springVersion = '4.1.4.RELEASE'
// Scala versions
scalaVersion = '2.12.3'
scalaBinaryVersion = scalaVersion.tokenize('.').take(2).join('.')
}
}
apply from: 'cm.gradle'
apply from: 'config.gradle'
apply from: 'db.gradle'
apply from: 'test.gradle'
subprojects {
//
// project specific dependencies
//
def springVersion = ext.springVersion
//
// Grails is VERY picky about spring version, so we will
// hold all versions to that defined above regardless of
// transitive dependencies
//
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.springframework' && details.requested.name != 'springloaded') {
details.useVersion springVersion
}
}
}
}
//
// Locations for common configuration
//
ext {
springJndiFile = "$rootDir/dev/jndi/data-source.xml"
}
configurations.all {
// already provided by the JVM, Grails complains if classes show up twice in the classpath
exclude group: 'log4j', module: 'log4j'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'commons-logging'
}
//
// Ensure files are compiled with the proper encoding
//
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(ScalaCompile) {
options.encoding = "UTF-8"
}
afterEvaluate {
if (plugins.hasPlugin('java')) {
dependencies {
// Logback (http://logback.qos.ch/)
runtime 'ch.qos.logback:logback-classic:1.1.3'
// SLF4J (http://www.slf4j.org/)
compile 'org.slf4j:log4j-over-slf4j:1.7.7' // and the log4j bridge
runtime 'org.slf4j:jcl-over-slf4j:1.7.2' // and the commons-logging bridge
runtime "p6spy:p6spy:1.3"
// Spring support (http://www.springsource.org/)
compile "org.springframework:spring-core:${springVersion}"
compile "org.springframework:spring-web:${springVersion}"
compile "org.springframework:spring-webmvc:${springVersion}"
compile "org.springframework:spring-jdbc:${springVersion}"
compile "org.springframework:spring-context-support:${springVersion}"
compile "org.springframework:spring-orm:${springVersion}"
compile "org.springframework:spring-aspects:${springVersion}"
testCompile "org.springframework:spring-test:${springVersion}"
// JPA2 annotations to satisfy a dependency of the spring-aspects
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final'
// Apache Commons (http://commons.apache.org/)
compile 'commons-cli:commons-cli:1.2'
compile 'commons-collections:commons-collections:3.2.1'
compile 'commons-configuration:commons-configuration:1.6'
compile 'commons-io:commons-io:1.4'
compile 'commons-validator:commons-validator:1.6'
// Database connection pooling (https://github.com/brettwooldridge/HikariCP)
compile 'com.zaxxer:HikariCP:2.3.7'
// Joda Time (http://joda-time.sourceforge.net/)
compile 'joda-time:joda-time:2.6'
// Guava (https://code.google.com/p/guava-libraries/)
compile 'com.google.guava:guava:18.0'
// Persistent Collections (http://code.google.com/p/pcollections/)
compile 'org.pcollections:pcollections:2.1.2'
// For removing HTML from error responses
compile "org.jsoup:jsoup:1.7.2"
// Tuples for Java (http://www.javatuples.org)
compile 'org.javatuples:javatuples:1.2'
// Jackson XML (https://github.com/FasterXML/jackson)
compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
// Jackson XML data binding for Joda Time (https://github.com/FasterXML/jackson-datatype-joda)
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.0'
// Jackson Java 8 types (https://github.com/FasterXML/jackson-datatype-jdk8)
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.5.0'
compile 'org.codehaus.groovy:groovy-all:2.4.11'
}
//
// Enable lint compilation for compile output
//
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked"
// Uncomment to display deprecated classes and usage
// options.compilerArgs << "-Xlint:deprecation"
}
//
// Add source jars to the build
//
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
}
}
}
//
// Include the IDE after the block defining the 'provided' configuration
// since that configuration is used for IntelliJ support.
//
apply from: 'ide.gradle'
// So IntelliJ doesn't complain about the output dirs in non-Java projects
idea.module {
outputDir = file("$buildDir/classes/main")
testOutputDir = file("$buildDir/classes/test")
}
task showStatus {
doFirst {
println "Current buildinfo properties: " + buildvcs.getInfo().toString()
}
}
uploadArchives.dependsOn(showStatus)
//
// Do some ordering for clean task for baseline subprojects
//
clean.dependsOn("business-logic:clean")
//
// build script dependency settings
//
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2/" }
maven { url "http://kercheval.org/mvn-repo/releases/" }
mavenCentral()
}
dependencies {
classpath 'org.kercheval:GradleCMPlugin:1.+'
classpath 'com.jcraft:jsch:0.1.+' // Force a newer version for the CM plugin to fix Github auth issues
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.2'
}
}
This is the internal-tools.gradle
description = 'Internal Tools'
ext {
grailsVersion = "3.3.10"
}
apply plugin: "org.grails.grails-web"
apply plugin: "war"
//apply plugin: 'groovy' //Did not help
grails {
grailsVersion = "3.3.10"
// springLoadedVersion = '1.2.4.RELEASE'
}
configurations.all {
// already provided by the JVM, Grails complains if classes show up twice in the classpath
exclude group: 'xml-apis', module: 'xml-apis'
exclude module: 'grails-plugin-log4j'
//provided servlet container
exclude group: 'javax.el', module: 'el-api'
exclude group: 'org.glassfish.web', module: 'el-impl'
}
dependencies {
compile project(':business-logic')
// test(project(path: ':business-logic', configuration: 'testArtifacts'))
def slf4jVersion = '1.7.2'
compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
compile "org.slf4j:jul-to-slf4j:${slf4jVersion}"
compile "org.slf4j:slf4j-api:${slf4jVersion}"
// We force a newer version of Ant to work around a bug in the Oracle JRE. This can be removed when Grails upgrades Ant
// See Ant 'Bug 54641' for more details
runtime "org.apache.ant:ant:1.9.2"
runtime "org.apache.ant:ant-junit:1.9.2"
// compile 'org.codehaus.groovy:groovy-all:2.4.15' //Did not help
// Grails
runtime "org.grails:grails-dependencies:$grailsVersion"
// Grails plugins
compile "org.grails.plugins:hibernate4:6.+"
compile "org.grails.plugins:tomcat:7.0.+"
compile "org.grails.plugins:export:1.6"
compile "org.grails.plugins:webflow:2.1.0"
compile 'org.grails.plugins:logback:0.3.1'
runtime "org.grails:grails-plugin-validation:$grailsVersion"
// test "org.grails:grails-test:$grailsVersion"
// test "org.grails:grails-plugin-testing:$grailsVersion"
// test 'org.hamcrest:hamcrest-all:1.1'
// test 'org.mockito:mockito-all:1.8.0'
// test 'nekohtml:nekohtml:1.9.6.2'
// bootstrap 'ch.qos.logback:logback-classic:1.1.3'
}
test {
doFirst {
tasks.getByPath(':dbTestCreate').ext.testDatabase.create()
}
dependsOn(':configProperties')
jvmArgs '-XX:MaxMetaspaceSize=256m'
systemProperty 'XXXXX.conf.file', "$configOutputDir/XXXXX_test.properties"
String protocol = "file:"
systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
bootRun {
dependsOn(':configProperties', ':dbValidate')
jvmArgs '-XX:MaxMetaspaceSize=256m'
systemProperty 'XXXXX.conf.file', "$configOutputDir/XXXXX_dev.properties"
String protocol = "file:"
systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
war {
String protocol = "file:"
// systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
// We re-package the war so it will include the extra GradleCM meta-info.
// We use a zip task rather than a war task because the war task adds extra files such as a second web.xml
task reWar(type: Zip, dependsOn: ['war']) {
destinationDir = file("$buildDir/libs")
extension = 'war'
// HACK: the input needs to be wrapped in a closure so it is evaluated lazily. This is because the 'war' task output
// file changes once the version is set
from { zipTree(war.archiveName) }
//
// Build info file
//
from (rootProject.buildinfo.filedir) {
include rootProject.buildinfo.filename
into 'META-INF'
}
}
artifacts {
archives reWar
}
// Ensure tests are run for uploadArchives
uploadArchives.dependsOn('check')
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2/" }
maven { url "https://dl.bintray.com/jfrog/jfrog-jars/" }
maven { url "https://repo.gradle.org/gradle/libs-releases-local/" }
maven { url "https://repo.spring.io/plugins-release/" }
maven { url "https://repo.maven.apache.org/maven2/" }
mavenCentral()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:3.+"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+"
classpath "org.gradle:gradle-tooling-api:5.+"
classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.7.+"
}
}
Any help is appreciated. This happened when we went from gradle 2.2 to gradle 4.10.2. I'm not sure if I need to upgrade groovy, or grails, or both. If I should post our other .gradle files I can but the other ones are building fine so I did not include them.
I tried adding the apply groovy plugin but that didn't help. I also added the compile 'org.codehaus.groovy:groovy-all:2.4.11' dependency and that did not help either. Has anyone ran into this problem when they upgraded gradle and have groovy/grails in their project?
This built fine with gradle 2.2. I really don't want to upgrade to a higher version than gradle 4.10.2 and I don't want to go below gradle 3.X, but I'm fine changing the version to something in between if that will help. I did try some other versions but that did not help either.

Related

Custom Gradle War Task Can't Find Zip

:internal-tools:reWar FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Cannot expand ZIP '/Users/XXXXXX/Documents/XXXX/XXXX/internal-tools/internal-tools-195.0-SNAPSHOT.war' as it does not exist.
internal-tools.gradle
description = 'Internal Tools'
ext {
grailsVersion = "3.3.3"
}
apply plugin: "org.grails.grails-web"
apply plugin: "war"
apply plugin:"org.grails.grails-gsp"
grails {
grailsVersion = "3.3.3"
//springLoadedVersion = '1.2.4.RELEASE'
}
configurations.all {
// already provided by the JVM, Grails complains if classes show up twice in the classpath
exclude group: 'xml-apis', module: 'xml-apis'
exclude module: 'grails-plugin-log4j'
//provided servlet container
exclude group: 'javax.el', module: 'el-api'
exclude group: 'org.glassfish.web', module: 'el-impl'
}
dependencies {
compile project(':business-logic')
//test(project(path: ':business-logic', configuration: 'testArtifacts'))
def slf4jVersion = '1.7.2'
compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
compile "org.slf4j:jul-to-slf4j:${slf4jVersion}"
compile "org.slf4j:slf4j-api:${slf4jVersion}"
// We force a newer version of Ant to work around a bug in the Oracle JRE. This can be removed when Grails upgrades Ant
// See Ant 'Bug 54641' for more details
runtime "org.apache.ant:ant:1.9.2"
runtime "org.apache.ant:ant-junit:1.9.2"
// Grails
runtime "org.grails:grails-dependencies:$grailsVersion"
compile "org.grails:grails-plugin-validation:3.3.3"
compile 'org.grails.plugins:converters:4.0.0'
compile 'org.grails.plugins:gorm-tools:6.1.11-v.12'
compile "org.grails:grails-plugin-databinding"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-core"
// Grails plugins
compile "org.grails.plugins:hibernate4:4.3.6.1"
compile "org.grails.plugins:tomcat:7.0.55"
compile "org.grails.plugins:export:1.6"
compile "org.grails.plugins:webflow:2.1.0"
compile 'org.grails.plugins:logback:0.3.1'
runtime "org.grails:grails-plugin-validation:$grailsVersion"
//test "org.grails:grails-test:$grailsVersion"
// test "org.grails:grails-plugin-testing:$grailsVersion"
// test 'org.hamcrest:hamcrest-all:1.1'
//test 'org.mockito:mockito-all:1.8.0'
// test 'nekohtml:nekohtml:1.9.6.2'
// bootstrap 'ch.qos.logback:logback-classic:1.1.3'
}
test {
doFirst {
tasks.getByPath(':dbTestCreate').ext.testDatabase.create()
}
dependsOn(':configProperties')
jvmArgs '-XX:MaxMetaspaceSize=256m'
systemProperty 'XXXX.conf.file', "$configOutputDir/XXXX_test.properties"
String protocol = "file:"
systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
bootRun {
dependsOn(':configProperties', ':dbValidate')
jvmArgs '-XX:MaxMetaspaceSize=256m'
systemProperty 'XXXX.conf.file', "$configOutputDir/XXXX_dev.properties"
String protocol = "file:"
systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
war {
String protocol = "file:"
//systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
// We re-package the war so it will include the extra GradleCM meta-info.
// We use a zip task rather than a war task because the war task adds extra files such as a second web.xml
task reWar(type: Zip, dependsOn: ['war']) {
destinationDir = file("$buildDir/libs")
extension = 'war'
// HACK: the input needs to be wrapped in a closure so it is evaluated lazily. This is because the 'war' task output
// file changes once the version is set
from { zipTree(war.archiveName) }
//
// Build info file
//
from (rootProject.buildinfo.filedir) {
include rootProject.buildinfo.filename
into 'META-INF'
}
}
artifacts {
archives reWar
}
// Ensure tests are run for uploadArchives
uploadArchives.dependsOn('check')
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2/" }
maven { url "https://dl.bintray.com/jfrog/jfrog-jars/" }
maven { url "https://repo.gradle.org/gradle/libs-releases-local/" }
//maven { url "https://repo.spring.io/plugins-release/" }
maven { url "https://repo.maven.apache.org/maven2/" }
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:3.3.3"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+"
classpath "org.gradle:gradle-tooling-api:5.+"
classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.7.+"
//classpath "org.grails.plugins:hibernate4:${gormVersion-".RELEASE"}"
}
}
Can anyone help me with my reWar task? I think it is a custom task. I need it to look here instead '/Users/XXXXXX/Documents/XXXX/XXXX/internal-tools/build/internal-tools-195.0-SNAPSHOT.war' . It seems to be looking here '/Users/XXXXXX/Documents/XXXX/XXXX/internal-tools/internal-tools-195.0-SNAPSHOT.war'

How to run grails integration tests with gradle

Old internal-tools.gradle
description = 'Internal Tools'
ext {
grailsVersion = "2.4.4"
}
apply plugin: "grails"
grails {
grailsVersion = "2.4.4"
springLoadedVersion = '1.2.4.RELEASE'
}
configurations.all {
// already provided by the JVM, Grails complains if classes show up twice in the classpath
exclude group: 'xml-apis', module: 'xml-apis'
exclude module: 'grails-plugin-log4j'
//provided servlet container
exclude group: 'javax.el', module: 'el-api'
exclude group: 'org.glassfish.web', module: 'el-impl'
}
dependencies {
compile project(':business-logic')
test(project(path: ':business-logic', configuration: 'testArtifacts'))
def slf4jVersion = '1.7.2'
compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
compile "org.slf4j:jul-to-slf4j:${slf4jVersion}"
compile "org.slf4j:slf4j-api:${slf4jVersion}"
// We force a newer version of Ant to work around a bug in the Oracle JRE. This can be removed when Grails upgrades Ant
// See Ant 'Bug 54641' for more details
runtime "org.apache.ant:ant:1.9.2"
runtime "org.apache.ant:ant-junit:1.9.2"
// Grails
runtime "org.grails:grails-dependencies:$grailsVersion"
// Grails plugins
compile "org.grails.plugins:hibernate4:4.3.6.1"
compile "org.grails.plugins:tomcat:7.0.55"
compile "org.grails.plugins:export:1.6"
compile "org.grails.plugins:webflow:2.1.0"
compile 'org.grails.plugins:logback:0.3.1'
runtime "org.grails:grails-plugin-validation:$grailsVersion"
test "org.grails:grails-test:$grailsVersion"
test "org.grails:grails-plugin-testing:$grailsVersion"
test 'org.hamcrest:hamcrest-all:1.1'
test 'org.mockito:mockito-all:1.8.0'
test 'nekohtml:nekohtml:1.9.6.2'
bootstrap 'ch.qos.logback:logback-classic:1.1.3'
}
test {
doFirst {
tasks.getByPath(':dbTestCreate').ext.testDatabase.create()
}
dependsOn(':configProperties')
jvmOptions.jvmArgs '-XX:MaxMetaspaceSize=256m'
jvmOptions.systemProperty('XXXX.conf.file', "$configOutputDir/XXXX_test.properties")
String protocol = "file:"
jvmOptions.systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
'grails-run-app' {
dependsOn(':configProperties', ':dbValidate')
jvmOptions.jvmArgs '-XX:MaxMetaspaceSize=256m'
jvmOptions.systemProperty('XXXX.conf.file', "$configOutputDir/XXXX_dev.properties")
String protocol = "file:"
jvmOptions.systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
war {
String protocol = "file:"
jvmOptions.systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
// We re-package the war so it will include the extra GradleCM meta-info.
// We use a zip task rather than a war task because the war task adds extra files such as a second web.xml
task reWar(type: Zip, dependsOn: ['war']) {
destinationDir = file("$buildDir/libs")
extension = 'war'
// HACK: the input needs to be wrapped in a closure so it is evaluated lazily. This is because the 'war' task output
// file changes once the version is set
from { zipTree(war.outputFile) }
//
// Build info file
//
from (rootProject.buildinfo.filedir) {
include rootProject.buildinfo.filename
into 'META-INF'
}
}
artifacts {
archives reWar
}
// Ensure tests are run for uploadArchives
uploadArchives.dependsOn('check')
buildscript {
repositories {
maven {
url "http://nexus.XXXXX.com/content/groups/public/"
}
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.1.2"
}
}
New internal-tools.gradle
description = 'Internal Tools'
ext {
grailsVersion = "3.3.3"
}
apply plugin: "org.grails.grails-web"
apply plugin: "war"
apply plugin:"org.grails.grails-gsp"
grails {
grailsVersion = "3.3.3"
//springLoadedVersion = '1.2.4.RELEASE'
}
configurations.all {
// already provided by the JVM, Grails complains if classes show up twice in the classpath
exclude group: 'xml-apis', module: 'xml-apis'
exclude module: 'grails-plugin-log4j'
//provided servlet container
exclude group: 'javax.el', module: 'el-api'
exclude group: 'org.glassfish.web', module: 'el-impl'
}
dependencies {
compile project(':business-logic')
//test(project(path: ':business-logic', configuration: 'testArtifacts'))
def slf4jVersion = '1.7.2'
compile "org.slf4j:jcl-over-slf4j:${slf4jVersion}"
compile "org.slf4j:jul-to-slf4j:${slf4jVersion}"
compile "org.slf4j:slf4j-api:${slf4jVersion}"
// We force a newer version of Ant to work around a bug in the Oracle JRE. This can be removed when Grails upgrades Ant
// See Ant 'Bug 54641' for more details
runtime "org.apache.ant:ant:1.9.2"
runtime "org.apache.ant:ant-junit:1.9.2"
// Grails
runtime "org.grails:grails-dependencies:$grailsVersion"
compile "org.grails:grails-plugin-validation:3.3.3"
compile 'org.grails.plugins:converters:4.0.0'
compile 'org.grails.plugins:gorm-tools:6.1.11-v.12'
compile "org.grails:grails-plugin-databinding"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-core"
// Grails plugins
compile "org.grails.plugins:hibernate4:4.3.6.1"
compile "org.grails.plugins:tomcat:7.0.55"
compile "org.grails.plugins:export:1.6"
compile "org.grails.plugins:webflow:2.1.0"
compile 'org.grails.plugins:logback:0.3.1'
runtime "org.grails:grails-plugin-validation:$grailsVersion"
//test "org.grails:grails-test:$grailsVersion"
// test "org.grails:grails-plugin-testing:$grailsVersion"
// test 'org.hamcrest:hamcrest-all:1.1'
//test 'org.mockito:mockito-all:1.8.0'
// test 'nekohtml:nekohtml:1.9.6.2'
// bootstrap 'ch.qos.logback:logback-classic:1.1.3'
}
test {
doFirst {
tasks.getByPath(':dbTestCreate').ext.testDatabase.create()
}
dependsOn(':configProperties')
jvmArgs '-XX:MaxMetaspaceSize=256m'
systemProperty 'XXXX.conf.file', "$configOutputDir/XXXX_test.properties"
String protocol = "file:"
systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
bootRun {
dependsOn(':configProperties', ':dbValidate')
jvmArgs '-XX:MaxMetaspaceSize=256m'
systemProperty 'XXXX.conf.file', "$configOutputDir/XXXX_dev.properties"
String protocol = "file:"
systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
war {
String protocol = "file:"
//systemProperty 'logback.configurationFile', protocol + new File(rootProject.projectDir,"dev/log/logback.xml").getAbsolutePath()
}
// We re-package the war so it will include the extra GradleCM meta-info.
// We use a zip task rather than a war task because the war task adds extra files such as a second web.xml
task reWar(type: Zip, dependsOn: ['war']) {
destinationDir = file("$buildDir/libs")
extension = 'war'
// HACK: the input needs to be wrapped in a closure so it is evaluated lazily. This is because the 'war' task output
// file changes once the version is set
from { zipTree(war.archivePath) }
//
// Build info file
//
from (rootProject.buildinfo.filedir) {
include rootProject.buildinfo.filename
into 'META-INF'
}
}
artifacts {
archives reWar
}
// Ensure tests are run for uploadArchives
uploadArchives.dependsOn('check')
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2/" }
maven { url "https://dl.bintray.com/jfrog/jfrog-jars/" }
maven { url "https://repo.gradle.org/gradle/libs-releases-local/" }
//maven { url "https://repo.spring.io/plugins-release/" }
maven { url "https://repo.maven.apache.org/maven2/" }
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:3.3.3"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+"
classpath "org.gradle:gradle-tooling-api:5.+"
classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.7.+"
//classpath "org.grails.plugins:hibernate4:${gormVersion-".RELEASE"}"
}
}
I had to upgrade gradle from 2.2 to 3.5. One of the gradle modules I have is a grails app called internal-tools. I posted the old build.gradle we used and the new one I am still working on. I had to change some of it around after upgrading gradle to 3.5.
The old internal-tools.gradle used to start up the application and run through a series of integration tests. My new internal-tools.gradle is not starting up the application and running through the integration tests. I was wondering if anyone had any ideas or ran into the same problem upgrading gradle and grails. I inherited this project so I'm not 100% sure what these gradle files are doing.
If the 'grails-run-app' task is what started it up in the old gradle file what is the equivalent I can use in gradle 3.5? I tried putting the same things in a "bootRun" task but that doesn't seem to work. It could be related to an issue I was having where the app thought it was spring boot so I had to stick a public static void main in there so the ":internal-tools:findMainClass" would work.
Actually the more I look at it I think the grails-run-app was just used to start up the application after it was built. So I'm not sure what started up the application and ran the integration tests in the old gradle file, and how I can reproduce the same thing with gradle 3.5

Error using Gradle Vaadin Plugin

I am trying to add Gradle Vaadin Plugin to my project, but I get the below error.
Errors in 'jar:file:/C:/Users/DEMO/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-user/2.8.1/9a13fbee70848f1f1cddd3ae33ad180af3392d9e/gwt-user-2.8.1.jar!/com/google/gwt/vali
dation/client/impl/GwtValidatorContext.java'
Line 29: The type GwtValidatorContext must implement the inherited abstract method ValidatorContext.parameterNameProvider(ParameterNameProvider)
Tracing compile failure path for type 'com.vaadin.client.communication.AtmospherePushConnection'
Errors in 'jar:file:/C:/Users/DEMO/.m2/repository/com/vaadin/vaadin-client/8.0.6/vaadin-client-8.0.6.jar!/com/vaadin/client/communication/AtmospherePushConnection.java'
Line 212: PUSH_ID_PARAMETER cannot be resolved or is not a field
Tracing compile failure path for type 'javax.validation.executable.ExecutableValidator'
Errors in 'jar:file:/C:/Users/DEMO/.gradle/caches/modules-2/files-2.1/javax.validation/validation-api/1.1.0.Final/7d49b53caed9bd81d172807c3e096d24f3c57090/validation-api-1.1.0.Fina
l-sources.jar!/javax/validation/executable/ExecutableValidator.java'
Line 53: No source code is available for type java.lang.reflect.Method; did you forget to inherit a required module?
Line 94: No source code is available for type java.lang.reflect.Constructor<T>; did you forget to inherit a required module?
Tracing compile failure path for type 'com.vaadin.client.communication.MessageHandler'
Errors in 'jar:file:/C:/Users/DEMO/.m2/repository/com/vaadin/vaadin-client/8.0.6/vaadin-client-8.0.6.jar!/com/vaadin/client/communication/MessageHandler.java'
Line 358: UIDL_PUSH_ID cannot be resolved or is not a field
Line 359: UIDL_PUSH_ID cannot be resolved or is not a field
Tracing compile failure path for type 'com.google.gwt.validation.client.impl.PropertyDescriptorImpl'
Errors in 'jar:file:/C:/Users/DEMO/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-user/2.8.1/9a13fbee70848f1f1cddd3ae33ad180af3392d9e/gwt-user-2.8.1.jar!/com/google/gwt/vali
dation/client/impl/PropertyDescriptorImpl.java'
Line 31: The type PropertyDescriptorImpl must implement the inherited abstract method CascadableDescriptor.getGroupConversions()
Errors in 'jar:file:/C:/Users/DEMO/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-user/2.8.1/9a13fbee70848f1f1cddd3ae33ad180af3392d9e/gwt-user-2.8.1.jar!/com/google/gwt/vali
dation/client/impl/ConstraintDescriptorImpl.java'
Line 35: The type ConstraintDescriptorImpl<T> must implement the inherited abstract method ConstraintDescriptor<T>.getMessageTemplate()
Line 35: The type ConstraintDescriptorImpl<T> must implement the inherited abstract method ConstraintDescriptor<T>.getValidationAppliesTo()
Tracing compile failure path for type 'com.google.gwt.validation.client.impl.GwtBeanDescriptorImpl'
Here is the page for the plugin: https://github.com/johndevs/gradle-vaadin-plugin/wiki
And, here is my build.gradle file:
buildscript {
ext {
springBootVersion = '1.5.3.RELEASE'
}
repositories {
mavenCentral()
maven {
url "http://maven.vaadin.com/vaadin-addons"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'com.devsoap.plugin.vaadin' version '1.2.1'
id 'org.springframework.boot' version '1.5.3.RELEASE'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'jacoco'
apply plugin: 'application'
jar {
baseName = 'testapp'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
maven {
url "http://maven.vaadin.com/vaadin-addons"
}
}
sourceSets {
main {
output.resourcesDir = "build/classes/main"
}
uiTest {
java.srcDirs=['src/ui-test/java','src/main/java']
resources.srcDir 'src/ui-test/resources'
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-jersey')
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')
// Spring Boot Security
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.security.oauth:spring-security-oauth2")
compile('org.springframework.security:spring-security-ldap')
// Spring Actuator
compile("org.springframework.boot:spring-boot-starter-actuator")
// Spring Boot JDBC Starter
compile("org.springframework.boot:spring-boot-starter-jdbc")
// Vaadin
compile('com.vaadin:vaadin-spring-boot-starter')
compile('com.vaadin:vaadin-push')
// Vaadin add-ons
compile("org.vaadin.spring.addons:vaadin-spring-addon-eventbus:2.0.0.RELEASE")
//Vaadin extentions
compile("org.vaadin.spring.extensions:vaadin-spring-ext-security:2.0.0.RELEASE")
// Lombok
compile("org.projectlombok:lombok")
// MyBatis
compile("org.mybatis:mybatis-spring:1.2.3")
compile("org.mybatis:mybatis:3.3.0")
// BoneCP - Connection Pooling
compile("com.jolbox:bonecp:0.8.0.RELEASE")
// PostgreSQL
compile("org.postgresql:postgresql:9.4-1204-jdbc42")
//Vaadin Testbench
uiTestCompile("com.vaadin:vaadin-testbench:5.0.0")
//TypeAhead widget
compile name: 'typeaheadSearchBox-1.0-SNAPSHOT'
}
// Create a new task called uiTest and set its type to Test.
// Configure the location of the compiled test classes.
// Configure the classpath that is used when our integration tests are run.
configurations {
uiTestCompile.extendsFrom testCompile
uiTestRuntime.extendsFrom testRuntime
}
task uiTest(type: Test) {
testClassesDir = sourceSets.uiTest.output.classesDir
classpath = sourceSets.uiTest.runtimeClasspath
}
dependencyManagement {
imports {
mavenBom "com.vaadin:vaadin-bom:8.0.3"
}
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
check.dependsOn jacocoTestReport
springBoot {
// Main class of #SpringBootApplication
mainClass = 'com.sample.test.Application'
}
When I check the gradle dependencies, I see 2 version of the "javax.validation:validation-api".
I believe that is causing the problem, but I could not find a way to force vaadin-client to use "javax.validation:validation-api:1.0.0.GA".
I appreciate if you can help me to correct the build.gradle.
The Gradle Vaadin plugin must see the Springboot plugin to do a proper setup. So you have to first use the Springboot plugin, then afterwards the Vaadin plugin.
The reason for the error you see there is, that the dep for javax.validation 1.1 from Springboot overrides all configurations (also the one used to build the client for Vaadin)
On a side note: you apply the Springboot plugin twice -- once in plugins, once with apply. I'd get rid of the buildscript-block and the apply. Then swap the items in plugins.

Building a fully executable Spring Boot 1.3 war from a Gradle multi project build

I'm trying to build a fully executable WAR using Spring Boot 1.3 as per https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html. If I build a single Gradle project, it all works fine, but I havea multi project build, where I have a "root" project and then several projects underneath it, and I cannot get it to build anything but a standard, "fat" WAR file, without the providedRuntime of Jetty and without the scripts to make it run.
Does anyone know how to do this?
In my root project, I have the following (abridged):
buildscript {
repositories {
mavenCentral()
}
ext {
springBootVersion = '1.3.0.RELEASE'
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
}
}
allprojects {
//Put instructions for all projects
repositories {
mavenCentral() // jcenter is missing spring-orm.4.1.6.RELEASE jar file so try mavenCentral first
jcenter {
url "http://jcenter.bintray.com/"
}
maven { url 'http://repo.opensourceagility.com/release' }
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'spring-boot'
}
and then in the subproject which is a web project, and which I'm trying to build, I have:
apply plugin: 'war'
dependencies {
// Include related projects
compile project(':project-model')
compile project(':project-dynamoDB')
// Core Spring Boot - note version is set in main build.gradle file
compile 'org.springframework.boot:spring-boot-starter-web'
// Remove Tomcat (included in -web) and include Jetty instead
providedRuntime 'org.springframework.boot:spring-boot-starter-jetty'
// Other Spring modules
compile 'org.springframework.boot:spring-boot-starter-social-facebook'
compile 'org.springframework.boot:spring-boot-starter-social-linkedin'
compile 'org.springframework.social:spring-social-google:1.0.0.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-devtools'
compile 'org.springframework:spring-context'
compile 'org.springframework:spring-context-support'
}
configurations {
providedRuntime.exclude group: 'org.springframework.boot', module:'spring-boot-starter-tomcat'
all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' // exclude when using log4j
}
springBoot {
mainClass = 'rs.web.Weblication'
executable = true
}
bootRun {
addResources = true
}
processResources {
// exclude resources if they look like they're profile dependent but don't match the current env/profile
eachFile { d ->
if(d.name.endsWith('.xml') || d.name.endsWith('.yaml') || d.name.endsWith('.properties')) {
//def fname = d.name.replaceFirst(~/\.[^\.]+$/, '')
//if(fname.indexOf("-") > -1 && ! fname.endsWith("-" + environment)) {
// d.exclude()
//} else {
// replace #variables# listed below in properties/config files
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
activeProfiles: environment
])
//}
}
}
}
war {
baseName = 'project-web'
version = '1.0.0'
manifest {
attributes 'Implementation-Title': baseName,
'Implementation-Version': version
}
webXml = file('src/main/resources/web.xml')
// rename the war task which has profiles appended from warName-profile,profile2.war
// to warName-profile.profile2.war
classifier = environment.replaceAll(',','-')
}
but when I build it (./gradlew build, or ./gradlew subprojectname:build), all is well and a working WAR is created, but not an executable one.
With a single project, I have it working fine.
Ah ha, right well I build a test multi-project build and it worked OK, so it was clearly the configuration above.
I worked through a process of elimination and it turns out that the problematic area was the line
classifier = environment.replaceAll(',','-')
which is intended to rename files with environment variables as part of the name. This process seems to get in the way of the script addition; perhaps it could be applied afterwards if it's really necessary.

Provided scope not working in eclipse

Gradle 2.2.1
I am trying to include dependencies into a jar file that I will ship to other users. I want them to provide their own versions of some dependencies and am trying to emulate the provided scope from maven.
I have followed the tutorial here. I am able to successfully build the project from the command line (while still getting classes not found errors in eclipse) until the eclipse integration part. From the post he says to add eclipse.classpath.plusConfigurations += configurations.provided but I am getting Could not find property 'provided' on configuration container
apply plugin: 'java'
apply plugin: 'eclipse'
// this causes the error
//eclipse.classpath.plusConfigurations += configurations.provided
sourceCompatibility = 1.8
version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': '...',
'Implementation-Version': version
}
}
repositories {
mavenCentral()
}
configurations {
provided
}
sourceSets {
main.compileClasspath += configurations.provided
test.compileClasspath += configurations.provided
test.runtimeClasspath += configurations.provided
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.+'
//Jackson
provided 'com.fasterxml.jackson.core:jackson-core:2.6.2'
provided 'com.fasterxml.jackson.core:jackson-annotations:2.6.2'
provided 'com.fasterxml.jackson.core:jackson-databind:2.6.2'
}
test {
systemProperties 'property': 'value'
}
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
Fixed it.
eclipse.classpath.plusConfigurations += configurations.provided
Should be an array
eclipse.classpath.plusConfigurations += [configurations.provided]

Resources