ResolutionException with Hibernate and JavaFx - gradle

Im having some issue and I had no luck figuring it out how to fix it.
I have a JavaFx Project which has Hibernate and Proguard. But whenever I try to run the task 'runProguard' fails with java.lang.module.ResolutionException.
What's puzzling me is the fact that my project doesnt use modules.
Is there anyway to fix this?
Task :runProguard FAILED Task ':runProguard' is not up-to-date
because: Task has not declared any outputs despite executing actions.
Starting process 'command ... Successfully started process 'command
'C:\Program Files\Java\openjdk-11_windows-x64_bin\bin\java.exe'' Error
occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules java.activation and
activation export package javax.activation to module java.transaction
:runProguard (Thread[Daemon worker Thread 6,5,main]) completed. Took
1.094 secs.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'net.sf.proguard:proguard-gradle:6.2.0'
}
}
plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.8'
id 'org.beryx.runtime' version '1.7.1'
}
dependencies {
compile "org.controlsfx:controlsfx:11.0.0"
compile "eu.hansolo:tilesfx:11.13"
compile "com.jfoenix:jfoenix:9.0.9"
compile "org.apache.httpcomponents:httpclient:4.5.9"
compile "org.json:json:20180813"
compile "mysql:mysql-connector-java:8.0.17"
compile "org.jasypt:jasypt:1.9.3"
compile "com.sun.mail:javax.mail:1.6.2"
compile "commons-validator:commons-validator:1.6"
// https://mvnrepository.com/artifact/org.hibernate/hibernate-c3p0
compile "org.hibernate:hibernate-c3p0:5.4.7.Final"
// https://mvnrepository.com/artifact/org.hibernate/hibernate-envers
compile 'org.hibernate:hibernate-envers:5.4.8.Final'
// https://mvnrepository.com/artifact/de.jensd/fontawesomefx-commons
runtime group: 'de.jensd', name: 'fontawesomefx-commons', version: '11.0'
// https://mvnrepository.com/artifact/de.jensd/fontawesomefx-fontawesome
compile group: 'de.jensd', name: 'fontawesomefx-fontawesome', version: '4.7.0-9.1.2'
}
repositories {
jcenter()
mavenCentral()
}
javafx {
version = "13"
modules = ['javafx.controls', 'javafx.graphics', 'javafx.fxml']
}
mainClassName = 'Main'
runtime {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
jpackage {
jpackageHome = 'C:/Program Files/Java/openjdk-14-jpackage+1-49_windows-x64_bin/'
if (org.gradle.internal.os.OperatingSystem.current().windows) {
installerType = 'msi'
imageOptions = []
installerOptions = ['--win-per-user-install',
'--win-dir-chooser',
'--win-menu',
'--win-shortcut',
'--verbose',
'--description', 'Test of proguard with jPackage',
'--name', 'Test-ProguardJPackage',
'--vendor', 'DoesItMatter']
}
}
}
jar {
dependsOn 'cleanAfterProguard'
manifest {
attributes(
'Main-Class': 'org.openjfx.Launcher'
)
}
from zipTree("${buildDir}/proguard/output.jar")
}
task cleanClasses(type: Delete) {
delete "${buildDir}/classes/java/main"
delete "${buildDir}/resources/java/main"
}
classes.dependsOn(cleanClasses)
// 2.2 Add proguard task
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: classes) {
injars project.sourceSets.main.output
outjars "${buildDir}/proguard/output.jar"
libraryjars project.sourceSets.main.compileClasspath
configuration 'proguard.conf'
}
// 2.3 Clean after proguard task
task cleanAfterProguard(type: Delete, dependsOn: proguard) {
delete "${buildDir}/classes/java/main"
delete "${buildDir}/resources/java/main"
}
// 2.4 Extract output jar to buildDir
task unpackProguardOutput(type: Copy, dependsOn: cleanAfterProguard) {
from zipTree("${buildDir}/proguard/output.jar")
into file("${buildDir}/classes/java/main")
}
// 3. Create a task to run the app with the proguarded buildDir
task runProguard(type: JavaExec, dependsOn: unpackProguardOutput) {
classpath = sourceSets.main.runtimeClasspath
jvmArgs = ['--module-path', classpath.asPath,
'--add-modules', 'javafx.controls,javafx.fxml']
main = 'Main' // <-- this name will depend on the proguard result
}
jar.dependsOn(unpackProguardOutput)
This is the repo:
https://github.com/KenobySky/hellofx

Related

Gradle - Generate source and compile

I'm migrating from Maven to Gradle and I have an issue with generated sources. Here's the build.gradle of one of the subprojects
plugins {
id 'war'
id 'net.ltgt.apt-idea' version '0.15'
}
dependencies {
...
compileOnly 'com.querydsl:querydsl-apt:4.2.1:jpa'
compileOnly 'org.hibernate:hibernate-jpamodelgen:1.3.0.Final'
}
def generatedSources = "${buildDir}/generated/source/apt/main"
def generatedOutputDir = file("$generatedSources")
task generateSources(type: JavaCompile, group: 'build') {
doFirst {
generatedOutputDir.exists() || generatedOutputDir.mkdirs()
sourceSets.main.java.srcDirs = ["${generatedSources}", 'src/main/java']
}
options.compilerArgs += [
'-processor', '-proc:none',
'org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor,' +
'com.querydsl.apt.jpa.JPAAnnotationProcessor',
'-AaddSuppressWarningsAnnotation=true',
'-Aquerydsl.entityAccessors=true',
'-s', "${generatedSources}"
]
}
compileJava.finalizedBy generateSources
The classes are generated correctly, but right after the generation I receive the error "no suitable method found for..."
Basically the compilation fails because the generated classes are not taken into account during the compilation phase.
With the finalizedBy I was pretty sure it would work, but no..
Any ideas on how else I can get the class generation to run before the compileJava phase?
This line
compileJava.finalizedBy generateSources
Should be
compileJava.dependsOn generateSources
See https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:adding_dependencies_to_tasks

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

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

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.

Detekt task fails only if ran without check task

I'm migrating detekt from 1.0.0.RC7-2 to the 1.0.1 and changing to use the new plugin syntax. I managed to make it work, but only when the full check task is executed.
If only the detekt task is executed then an error is shown.
The detekt task is failing with the following error:
Task :detekt FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':detekt'.
Could not resolve all files for configuration ':detekt'.
Cannot resolve external dependency io.gitlab.arturbosch.detekt:detekt-cli:1.0.1 because no repositories are defined.
Required by:
project :
detekt.gradle
apply plugin: 'io.gitlab.arturbosch.detekt'
detekt {
config = files("$rootDir/detekt/detekt-ruleset.yml")
filters = ".*build.*,.*/resources/.*,.*/tmp/.*"
input = files("src/main/java", "src/test/java")
reports {
html.enabled = true
xml.enabled = false
txt.enabled = false
}
}
build.gradle (project):
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.1"
}
}
plugins {
id "io.gitlab.arturbosch.detekt" version "1.0.1"
}
build.gradle (module):
repositories {
jcenter()
google()
}
apply from: "$rootDir/detekt/detekt.gradle"
I managed to make it work by creating a task for Detekt and not using the plugin:
detekt.gradle
configurations {
detekt
}
dependencies {
detekt "io.gitlab.arturbosch.detekt:detekt-cli:1.0.1"
}
task detekt(type: JavaExec) {
main = "io.gitlab.arturbosch.detekt.cli.Main"
classpath = configurations.detekt
def input = "$rootDir"
def config = "$rootDir/detekt/detekt-ruleset.yml"
def exclude = ".*/resources/.*,.*/build/.*"
def report = "html:${project.buildDir}/reports/detekt.html"
def params = ['-i', input, '-c', config, '-ex', exclude, '-r', report]
args(params)
}
check.dependsOn detekt
build.gradle (project)
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.1"
}
}
According to this issue filed on detekt repo, you have to configure it on the root project, not on the app module.

Resources