Gradle 1.7 with Java 1.8: compileGroovy error? - java

When I try to build my java project using Java 1.8 and Gradle 1.7 I am getting the following error:
Execution failed for task ':compileGroovy'.
> BUG! exception in phase 'semantic analysis' in source unit 'C:\...\groovy\org\gradle\plugins\svnkit\GroovySvnKitPluginConve
ntion.groovy'
Could not load class 'org.gradle.plugins.svnkit.svnclient.WorkingC
opy' from file:/C:/.../gradle/p
lugins/svnkit/svnclient/WorkingCopy.class.
My project builds in Java 7, what could be the issue now with Java 8?

What version of Groovy are you compiling with (in your dependencies)?
Groovy doesn't support Java 8 until 2.3.
If that doesn't fix it, and it is a more internal Gradle issue (it's hard to tell as you don't post and example build script, or the full exception), you might need to upgrade to Gradle 2+ as that is when they migrated to the Java 8 supporting versions of Groovy.

Related

Could not initialize class org.codehaus.groovy.runtime.InvokeHelper

Spring Boot Project
I'm using gradle 5.2.1 I can't change the version because I'm working on someone else's code. When I build the project in IntelliJ I get the following error:
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokeHelper
I'm using IntelliJ terminal in my code folder with command ./gradlew clean build install.
when I check ./gradle -version it shows JVM: 16.0.2
I feel the problem is with my jdk version.
As per compatibility matrix , only gradle versions of 7 are supporting java 16.
May be you can use older version of jdk which is supporting your current gradle.

IntelliJ IDEA unable to build Java -source 8 project via Gradle

I am using IntelliJ IDEA 2020.1.2 and I am getting the message:
"default methods are not supported in -source 7"
and that I may use:
"-source 8 or higher" when I'm building my project via Gradle."
I have ensure that the Project SDK is at least 1.8 and project language level is 8 in every module in the Project Structure.
Java compiler Javac is working with project bytecode version 8.
What could I be missing? Any help or advice is appreciated.
Thank you.

Issues with running a LibGDX project

I downloaded the libGDX setup jar file, I generated a project and imported it (to eclipse). Once I try to run the project eclipse outputs an error:
Description Resource Path Location Type
Could not create an instance of Tooling API implementation using the specified Gradle distribution 'https://services.gradle.org/distributions/gradle-4.6-bin.zip'.
Could not create service of type FileMetadataAccessor using NativeServices.createFileMetadataAccessor().
Could not determine java version from '11.0.2'.
I have no idea how to solve this problem.
The problem is that you are using Java 11. Try it with Java 8. The HTML module does not compile with a Java version greater then 8.
Gradle 4.6 likely does not support Java 11.
You can either upgrade to a newer version of Gradle or downgrade your JDK version.
I would recommend updating to Gradle 4.10.2 as it is the latest Gradle 4 variant (you can try Gradle 5 however it may introduce some breaking changes)
This can be done by running in the root of your project:
Linux / MacOS:
./gradlew wrapper --gradle-version=4.10.2
Windows:
gradle wrapper --gradle-version=4.10.2

Eclipse Oxygen/Neon: Unable to build ANT project

I am running into an issue. I am trying to build my code which is a legacy one built on Java 1.6. However, when i am trying to build it using ANT with a similar version then run into the JRE version 1.7 or greater is supported. I tried following instructions with Eclipse NEON but no luck.
https://blog.sibvisions.com/2016/06/30/eclipse-neon-with-ant-and-jre6/
I have a Eclipse Oxygen IDE and tried with it too but even it doesn't work.
The only challenge I can't move to the latest version while building .xml file is because the hosting server supports JDK 1.6 only.
Incase, if there is a way out then please suggest.
P.S:- added the error message in the below comment.
HERE IS THE ERROR MESSAGE
the JRE version 1.7 or greater is supported"
The ANT plugin form blog.sibvisions.com was created for Neon or Mars. There's a new plugin available for Oxygen.1. Simply search the blog.
The problem with eclipse is that the standard ANT plugin was created based on Java 7 and it has a version check built-in. It's not possible to use the standard ANT plugin with Java6... So use an older eclipse version or the modified ANT plugin.
I don't know the reason why the original ANT plugin is using Java 7 because the source can be written with Java 6 compatibility without problems. This is what the modified ANT plugin does.

AnnotationProcessorFactory class not found in java 8

I had a project which is build on java 1.6 and
Now i upgraded the java verion to 1.8 and build the project
Here i have used gradle for building the project
Here is the gradle code
task wsgen(dependsOn: compileJava) {
doLast{
ant {
taskdef(name:'wsgen',
classname:'com.sun.tools.ws.ant.WsGen',
classpath:configurations.jaxws.asPath)
wsgen(keep:true,
destdir: "${buildDir}",
resourcedestdir:"${sourceSets.main.output.resourcesDir}",
sourcedestdir:'src/main/java',
genwsdl:'true',
classpath:"${configurations.compile.asPath}:${sourceSets.main.output.classesDir}",
sei:'<sei implementation class>')
}
}
}
and the error , am getting is
java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory
Can any one tell me, where the issue is located and raising from?
Thank you!!!
Thanks go out to #McDowell for the useful comment with links. So the APT tool is gone. Use a version 7 JDK for building your project. Just install it alongside your java 8 JDK and create a script specifically for building your project that requires the APT tool.
I had the same problem and went around it by running maven using the 1.7 version of JDK. So I created a script (.cmd on windows platform) that, for me, looks like this:
set JAVA_HOME="c:\Java\ibm-jdk-1.7.0"
set PATH=%JAVA_HOME%\bin;%PATH%
mvn clean install eclipse:eclipse
This will successfully build using an IBM version of the java 7 jdk, which i happen to have in my java folder. I hate the fact that I can't build my projects with the version 1.8 jdk but at least i can use java 8 features on other projects.

Categories

Resources