INFO:
I built this project awhile ago with Groovy 2.4.4 that utilizes the groovy-all-2.4.4.jar file. The newest version of Groovy is 4.0.3 that doesn’t have a pre-compiled “all” jar file, I have to include the needed jars manually.
ISSUE:
When I compile with the original dependency of just “groovy-2.4.4-all.jar”, there are no issues with the build and I get a build JAR file as needed.
However, when I update the dependencies to use Groovy 4.0.3, I’m getting the dreaded “unable to resolve class” on classes that had no issues when compiled with Groovy 2.4.4-all jar.
I can get that part, but what is stumping me is that I cannot figure out if this is a Groovy or Gradle issue.
Any suggests on pointers of how to go about addressing this build issue?
VERSIONS:
$ groovy -v
Groovy Version: 4.0.3 JVM: 1.8.0_271 Vendor: Oracle Corporation OS: Windows 10
$ gradle -v
------------------------------------------------------------
Gradle 7.0.2
------------------------------------------------------------
Build time: 2021-05-14 12:02:31 UTC
Revision: 1ef1b260d39daacbf9357f9d8594a8a743e2152e
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_271 (Oracle Corporation 25.271-b09)
OS: Windows 10 10.0 amd64
BUILD FILE:
build.gradle:
plugins {
id 'groovy'
}
group 'com.example.project'
version null
repositories {
mavenCentral()
}
jar {
archivesBaseName='theFinalJar'
archiveVersion = null
}
dependencies {
// These are needed for Groovy 4.0.3 update, but fail cause "unable to resolve class"
implementation group: 'org.apache.groovy', name: 'groovy', version: '4.0.3'
implementation group: 'org.apache.groovy', name: 'groovy-sql', version: '4.0.3'
implementation group: 'org.apache.groovy', name: 'groovy-dateutil', version: '4.0.3'
// Previous item, swapping to just this will work without issue.
// implementation 'org.codehaus.groovy:groovy-all:2.4.4'
}
** Update **
To expand on the further weirdness of this, here is the code in question that is giving me issues. When I change the data type of “def” to “String” for “JobAuditMode”, the code compiles.
class jobParams {
// Work Variables
private def JobNumber
private def JobLocation
private def JobFileName
private def JobAuditMode
// private String JobAuditMode // This works!
// Default constructor
JobsubParams() {
this.JobNumber = ""
this.JobLocation = ""
this.JobFileName = ""
this.JobAuditMode = ""
}