I had this issue when I try to setup my project on my new pc.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':in_app_update:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
I tried to find the solution here and some says its because of the kotlin version
I need some pointers out here, thanks in advance!
Without more context is hard to say, but when compilation fails the errors are usually listed somewhere else (before the failure). Read the whole output of Gradle and look for lines starting with e:.
Looking at your first image which says:
> Task :app:kaptGenerateStubsDebugKotlin
'compileDebugJavaWithJavac' task (current target is 1.7) and 'compileDebugKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
Depending on your Kotlin version and gradle.properties contents the JVM incompatibility might be a warning or an error. Since it doesn't say "it will become an error", suggests that the flag is on error.
This is the part I'm missing:
By default will become an error since Gradle 8.0+! Read more: https://kotl.in/gradle/jvm/target-validation
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
So you have a few options. Set up your PATH / JAVA_HOME to point to Java 7 installation, I think you have Java 8 now, but the project expects 7 (or the other way around). Without seeing targetCompatibility / jvmTarget DSL, it's hard to tell.
Anyway, just recently we reported a similar issue to Kotlin and they provided a very clean solution: https://youtrack.jetbrains.com/issue/KTIJ-24311/#focus=Comments-27-6798448.0-0
build.gradle (for each module):
kotlin {
jvmToolchain(7)
}
This is what the documentation also suggests.
If you can't make it work by juggling Java versions, you can disable the warning and maybe that will make it work:
gradle.properties:
kotlin.jvm.target.validation.mode=ignore
This is documented here. Please understand what you're turning off and that it'll break things now or in the future if you do.
I am getting the below mentioned error when the following plugins are included:
sonar-checkstyle-plugin-2.4.jar
sonar-findbugs-plugin-3.3.jar
sonar-pmd-plugin-2.5.jar
Logs:
ERROR : java.lang.IllegalStateException: Fail to instantiate class
[org.sonar.plugins.checkstyle.CheckstylePlugin] of plugin [checkstyle]
at org.sonar.core.platform.PluginLoader.instantiatePluginClasses(PluginLoader.java:146) ~[sonar-core-5.3.jar:na]
at org.sonar.core.platform.PluginLoader.load(PluginLoader.java:73) ~[sonar-core-5.3.jar:na]
at org.sonar.server.plugins.ServerPluginRepository.loadInstances(ServerPluginRepository.java:274) ~[sonar-server-5.3.jar:na]
at org.sonar.server.plugins.ServerPluginRepository.start(ServerPluginRepository.java:108) ~[sonar-server-5.3.jar:na]
The same error is given for the above mentioned plugins.
As these versions are supported for the version 5.3 (with reference to compatibility matrix in official documentation), need some help regarding fixing this error.
I am using MySQL database for the SonarQube 5.3. The installation works fine when the above mentioned plugins are removed from SONAR_HOME/extensions/plugins directory.
Is there some issue with this plugins for version 5.3? Has anyone tested these plugins on this version? Let me know if anyone has faced same issues and found out the solution to this problem.
When trying to compile my Game with roboVM, I keep getting the error:
java.lang.IncompatibleClassChangeError: class org.robovm.compiler.plugin.objc.ObjCProtocolProxyPlugin$1 has interface org.objectweb.asm.ClassVisitor as super class
I have investigated some many hours, coming to the conclusion that it has to do with the ASM library: In the library ASM, up to version 3.3.2, the class ClassVisitor was an interface. It got promoted to an abstract class in 4.0 and the robovm backend bytecode uses a >= 4.0 version while my SBT builder tries to use a version < 4.0.
The roboVM code in question can be found here: https://github.com/robovm/robovm/blob/master/compiler/src/main/java/org/robovm/compiler/plugin/objc/ObjCProtocolProxyPlugin.java#L145
Now, while I realize that this is the issue, I have no idea how to fix / work around it. I do not want to compile libGDX from source...
To setup my app I used existing templates, namely this one: https://github.com/ajhager/libgdx-sbt-project.g8. Also, I use the latest versions respectively:
sbt 0.13.5
libGDX 1.4.1
scala 2.11.3
roboVM 1.0.0-alpha-04
Now when I investigated further, searching for the culprit in this conglomerate, I found that indeed two 'asm's were included in the classpath, the one with version 3.3.1 being mentioned earlier:
scalac -classpath ...:~/.ivy2/cache/asm/asm-all/jars/asm-all-3.3.1.jar:...:~/.ivy2/cache/org.ow2.asm/asm-all/jars/asm-all-4.2.jar:...
This obviously caused the crash. Now I only had to find the place where 3.3.1 was set as dependency and I was rather quick in finding it, at long last: pfn/android-sdk-plugin. For whatever reason, they set this as a dependency (albeit somehow not using it in their code). There were evidently no conflicts since the group ids differed: asm:asm-all:3.3.1 vs org.ow2.asm-all:4.2.
This is easily the dumbest thing I have ever walked across and I'm grinding my teeth that it took so long and so much debugging to get behind it. Hmpf!
I fixed it by cloning the android-sdk-plugin repository and adjusting the ASM version / group id to 4.2. I then continued to sbt publish-local and increased the version number dependency in my project to fit the cloned SNAPSHOT version's.
I hope this will help anyone that stumbles across this behaviour.
So long,
Danyel.
I'm trying to develop on the Scala compiler project with the help of ScalaIDE. I followed this guide to set up the development environment. When I now try to build the mentioned projects, the reflect project won't get built. Instead, I get the following error via the console output:
uncaught exception during compilation: scala.reflect.internal.MissingRequirementError reflect Unknown Scala Problem
Having tried the provided ANT script of the project via the console, everything seems to work fine.
Does anyone know if I'm missing a hidden compiler flag, dependency or something like this?
Thanks!
With the IDE for Scala 2.10 you can only build the 2.10.x branch of the Scala compiler. If you want to work on master, you need to install a 2.11-based version of the IDE. We don't publicise IDE for 2.11 nightlies yet, but they are available at:
http://download.scala-ide.org/nightly/scala-ide-master-2.11.0-SNAPSHOT/
I successfully implemented and ran several Scala tutorials in Eclipse using the Scala plugin. Then suddenly I tried to compile and run an example, and this error came up:
Exception in thread "main" java.lang.NoClassDefFoundError: hello/HelloWorld
Caused by: java.lang.ClassNotFoundException: hello.HelloWorld
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
After this point I could no longer run any Scala programs in Eclipse. I tried cleaning and rebuilding my project, closing and reopening my project, and closing and reopening Eclipse.
Eclipse version number 3.5.2 and Scala plugin 2.8.0
Here is the original code:
package hello
object HelloWorld {
def main(args: Array[String]){
println("hello world")
}
}
If you see this when you attempt to run as a Scala application then the most likely explanation is that your project didn't compile and no class files were generated. Please check whether or not that's the case: look in your project's output folder for hello/HelloWorld.class.
If your project didn't compile that could either be because there's an error which you've missed (and if this error isn't being reported in the Problems view that could be a bug, in which case please open a ticket on Trac) or because you've turned off automatic builds and not done a manual build of your project.
I had the same problem. Project doesn't compile but there are no errors highlighted and AFAIK the code is OK. It seems to be a problem with the Run Configurations.
Solution 1: Delete the existing Run Configuration for your object and create a new one
Solution 2: Create a new object and cut / paste all your code into that file
When running "clean" does not un-hose Eclipse, I next try saving my work, exiting Eclipse, and re-starting. That usually gets things going again, but not always. A few times I've had to update the Scala plugin with a more recent version (I'm using the latest nightly), to get things working again. I doubt that this worked because the new plugin happened to fix the bug, but rather expect that loading the new plugin gives the whole Eclipse-Scala
system a "total reset" that gets it unhosed.
I was getting this problem in a project that combined .java & .scala files.
The solution for me was:
Remove all .java files
Edit the scala code as needed so it compiles without them.
Add the .java files back in.
Edit the scala code back.
The other solutions given here didn't work for me. I tried: clean project, restarting Eclipse, closing-&-opening the project, creating a new .scala file. No joy.
I'm using Eclipse 3.7 (latest stable), Scala IDE 2.0.0 and Scala 2.9 on Ubuntu Linux 11.10.
The symptoms in my case were:
My project was working, but then it stopped compiling for no apparent reason. The IDE didn't show any compilation errors for .scala files, but there were no .class files in the output directory & I got a NoClassDefError if I tried to run anything.
If I created a deliberate error in a .scala file, that did get picked up as a compilation error.
The .java files were registering errors due to the missing scala classes.
I suppose there's probably a boot-strapping bug somewhere in the IDE plugin for .java/.scala mixes. I've done hybrid projects with this setup without problems, so it's only triggered in some situations. I don't know what the trigger is, but once triggered, there's no nice solution.
I had moved my one and only class/object/application to a package, but had not added the package declaration.
sbt compiled and ran fine; eclipse would not
Adding the package declaration at the top of the file fixed it.
Scala 2.8.3 plugin; no compile error
I encountered this error too but after doing the suggestions here (cleaning, deleting Run Configuration etc), I realized that I set the workspace wrongly that is why the class is not being found.
An indication that this is a problem is when the same error occurs when you try to compile a java project.
I encountered this error (compilation worked in sbt but failed in eclipse) when I created a new package object called "common". Deleting the package object in eclipse caused the compile error to go away. There was nothing in it.
I was using sbt-eclipse to build the eclipse project. I'm using scala eclipse 3.0.0-vfinal-20130326-1146-Typesafe.