SonarQube version <-> SonarJava version <-> Custom Plugin - java

I'm trying to implement a custom SonarQube plugin which also works fine on my dev machine in Eclipse, but as soon as I deploy it to our SonarQube instance it crashes during runtime with a ClassNotFoundException. The class which it can't find during runtime is ExpressionsHelper, which (as far as I understand it) should be in the sonar-java-plugin-***.jar.
Our SonarQube instance is running version 6.1, the SonarJava plugin is installed in version 4.15.0.12310.
Now to which version(s) should I set which property in my pom.xml so that the configuration on my dev machine matches the available libraries on the SonarQube instances? I've tried setting them to sonar.version=6.1, java.plugin.version=4.15.0.12310 but then I still got the ClassNotFoundException during the scan.
Thanks for your help in advance.

If the class is not part of package starting with : org.sonar.plugins.java.api it won't be found at runtime.
org.sonar.java.checks.helpers.ExpressionHelper is not part of this package and so won't be found at runtime, hence the exception you encounter.

Related

#Generated annotation using gradlew + dagger

I'm confronting a weird issue using gradlew(4.10.2) + dagger(2.18).
The problem is when I call:
./gradlew :app:compileDebugAndroidTestKotlin
The build fails with:
Task :Common:compileDebugJavaWithJavac FAILED
/CommonModule_ProvidesGsonFactory.java:6: error: package javax.annotation.processing does not exist
import javax.annotation.processing.Generated;
/CommonModule_ProvidesGsonFactory.java:8: error: cannot find symbol
#Generated(
But if I run the task from Android Studio, the task succeed and the #Generated is not present in the dagger generated class.
Do you have some clue to avoid the #Generated annotation using ./gradlew?
if you have :
javax annotation does not exist
I have this issue on my macOS
this error occures because your jdk is above of 1.8
just add below code on build.gradle of your apps .
//Resolve jdk8+ Generation Annotations - javax annotation does not exist
compileOnly 'com.github.pengrad:jdk9-deps:1.0'
Dagger uses auto-common's GeneratedAnnotations to figure out which #Generated annotation to use. It does this based on the classpath.
What this means is that while the annotation processor is running, javax.annotation.processing.Generated is available and used in the generator, but when the resulting file is compile in another task, it is no longer on the classpath.
Potential causes could be that code was generated using a newer version of the JDK and the incremental build is invalid, requiring a full "clean & rebuild" or there is a problem with java language levels where the annotation processor runs on Java 9+, but android is compiled as Java 8 or lower.
Using ./gradlew compileDebugAndroidTestKotlin -Dorg.gradle.java.home=<Android studio jre path> solved the problem.
I had this problem when I updated my Android Studio to 4.2
The problem was solved when I upgrade the Kotlin version from 1.3.51 to 1.4.31
It seems the problem is reported and solved in this issue:
https://github.com/google/dagger/issues/1449
https://youtrack.jetbrains.com/issue/KT-32804
change to embeded Android studio version and only clean!(not rebuild) Improove #kiskae answer
I also got "package javax.annotation.processing does not exist import javax.annotation.processing.Generated" in Android Studio while trying to build the project with Gradle.
Due to some reasons I cannot upgrade any dependencies in the project. What worked for me in this case:
not only install Java 8 instead of any higher Java versions you have (you can download it from here, for example: https://www.oracle.com/ru/java/technologies/javase/javase-jdk8-downloads.html),
but also check out Project Structure -> SDK location -> JDK location and make sure that this folder really contains jdk. The right option to choose can start with JAVA_HOME, for instance.
My case was that after some update this location was set by default as embedded JDK which did not contain any jdk and as a quite newbie to Android I have spent a couple of beautiful hours trying to figure out what's wrong with my Java 8.
In my case I change "Gradle JDK" and it's work perfectly.
Go to "File ==> project structure ==> SDK Location ==> Gradle settings ==> then change the selected gradle JDK from the drop down menu "
Hope this will help you.

#Transactional not an annotation

I am trying to rebuild a grails application using ggts 3.4.0 with groovy 2.1.8, grails 2.3.3 and java 1.7.
In the services files I'm getting these error messages:
Groovy.class grails.transaction.Transactional is not an annotation in #grails.transaction.Transactional
I believe that one of the components listed above is causing this problem. Can someone suggest which particular one and the required version I need?
Incidentally, I've successfully built this in the past with different versions of the various components but I'm not sure what they were. I do have backups - so if you can suggest where can I find details of these builds that would help.
I would welcome any suggestions?
-mike

Sphinx classes not found despite library being in classpath?

I downloaded sphinx4-1.0beta6-bin.zip and installed it on my 64-bit Ubuntu 12.04 LTS. I was able to run the HelloWorld example. However, when I create my own class and create a Configuration object as shown here:
Configuration configuration = new Configuration();
It gets flagged as an error. Eclipse cannot find the class at all even though I have appropriate jars in the library and library is in the build path.
Here are the jars in the library:
js.jar
jsapi.jar
sphinx4.jar
tags.jar
Then, why am I getting this error ?
This class doesn't exist in released version, to use it you need to checkout an experimental hl-interface branch with subversion:
http://sourceforge.net/p/cmusphinx/code/HEAD/tree/branches/hl-interface/
To learn more about subversion see
http://www.ibm.com/developerworks/library/os-ecl-subversion/

Class not found exception for com/google/appengine/tools/enhancer/Enhance when starting eclipse

I did a fresh download of Eclipse Juno and installed Google App Engine SDK.
After this whenever I start eclipse I get an error
Could not find the main class:
com.google.appengine.tools.enhancer.Enhance. Program will Exit.
Edit:
Looks like there is a Builder that gets added by the Google AppEngine Plugin. Eclipse tries to find this "Builder" and fails.
I added the path to this builder which resides in plugins\com.google.appengine.eclipse.sdkbundle_1.8.3\appengine-java-sdk-1.8.3\lib to my system classpath.
Now I get a different error
DataNucleus Enhancer (version 3.1.1) : Enhancement of classes
Aug 21, 2013 8:48:14 PM org.datanucleus.metadata.MetaDataManager loadClasses
SEVERE: Class "in.chimanrao.model.Account" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
org.datanucleus.exceptions.ClassNotResolvedException: Class "in.chimanrao.model.Account" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
How do I pass custom classpath to this DataNucleus Enhancer?
I solved it by installing JDK 1.7 and making it the default in Eclipse.
If you work with a database, install the previous version JDK 7u21 because the latest version has some issues with databases.
As others have noted, you must use JRE1.7 or above. What isn't stated is that it may be necessary to update Eclipse to use 1.7 and then your project. It may also be necessary to remove the earlier JRE version from the project's buildpath. Detailing all of the steps here is a bit much but I found that the following tutorial includes all necessary steps:
https://spragucm.wordpress.com/2015/05/11/class-not-found-exception-for-comgoogleappenginetoolsenhancerenhance-when-starting-eclipse/

Strange GWT exceptions in Designer

I've started encountering some weird exceptions trying to use the GWT designer. I'm on Ubuntu if it matters, GWT 2.4.0, Java 1.6.0_20 x64
When I use the designer, a previously used DisclosurePanel shows up in a pink box indicating. When viewing the details, it indicates a NoClassDefFound error. This makes no sense because in the code editor, the class is visible and compiles without error.
Secondly, I am unable to drop a CellTable instance on the designer. Even with the most basic T = java.lang.Object, the error comes back indicating an IllegalArgumentException : "Unable to find 'columns' in class com.google.gwt.user.client.UI.HTML.
This was working yesterday with the designer, but all of a sudden has entered the crapper. I tried reinstalling the GWT plugins, and even using a new eclipse install with fresh GWT plugins installed, but to no avail. Does anyone know the source of these errors and how to remedy them?
Alright, it seems that the other day I synced up my build machine for the fisrt time and had a different version of java installed on my dev machine. OpenJDK 1.6.0_20 (Iced Tea 1.9), vs Java SE 1.6.0_35.
Since this java was in my /usr/bin which was earlier in my PATH envi var than my 1.6.0_35 build that was at the end of the PATH, it was using hte older 0_20 version. I'm guessing the GWT designer was built with something closer to 1.6.0_35 than 1.6.0_20, and was causing conflicts as implied here.:
Start by checking your Eclipse ".log" file (found in your /.metadata directory). If the error references one of your classes or methods, check that your classpath properly references the class you are trying to use. Also check that your class is properly compiled (no red X's) and that a .class file exists in your projects /bin directory. A mismatch between the JDK used to compile your code and the JVM used to run Eclipse can also manifest itself as a NoClassDefFoundError problem. For example, if you compile your code using JDK 1.5 or 1.6 and then run your Eclipse using a 1.4 or 1.5 JVM, you can have this problem. If the error refers to a custom widget, you should also check that your component does not trigger an exception during its initialization (which can manifest itself as a NoClassDefFoundError). Try refreshing and cleaning your project using the Project > Clean... or Project > Build Project commands. If that does not help, send a test case to support.

Categories

Resources