Sonarqube - how to enable license-checker for Kotlin projects? - java

I'm setting up a Sonarqube Developer Edition server and am trying to use the license-checker plugin I got from:
https://github.com/porscheinformatik/sonarqube-licensecheck
The plugin's jar is deployed to the correct directory and I have created a new Sonar way (license) Java profile that inherits the profile Sonar way (Built-in). In the new profile, I added the "License is not allowed" and "Dependency has unknown license" rules the plugin requires to work. I tested with a Java project and it works flawlessly.
I tried the same approach for the Kotlin profile Sonar way (license) I created and that inherits the Sonar way (Built-in) profile. But these rules are not available to Kotlin and, thus, the License check plugin does not run when I attempt to analyze a Kotlin project.
This seems to be a Java-specific plugin, but I might be mistaken. Is there a way to get this working I am not realizing?

Long story short, the plugin does not support my scenario.
Long story, my question was not clear enough and I failed to put some information as I was learning about this build myself. The project is in Kotlin and uses gradle to handle dependencies. The plugin only supports maven and NPM builds. So, for my to achieve the desired result, I would need to extend the plugin to handle the build.gradle.kts file. This task is a very big question mark in itself, so I will be looking at another alternative for the time being.

Related

Intellij 2022.3.1 won't load the AspectJ plugin

I'm building a Minecraft plugin that passes the functions to a Lua interpreter, and after exploring all other options for doing hooks without manually writing everything (i.e. using a built in function from Spigot that lets me easily intercept every event handler; I am not able to use arguments with this, making it worthless for my case) I've discovered my best option is AspectJ.
I installed the latest version of IntelliJ, then installed the relevant plugin and followed the instruction to "add a library containing aspectjrt.jar to my project" (I added org.aspectj:aspectjrt:1.9.19 through build.gradle, and added 'include 'aspectjrt:1.9.19'' to my settings.gradle). It also says to add a facet, but I can't do that due to the error "Requires plugin 'com.intellij.aop' to be installed." I can't find any reference to a dedicated AOP plugin for IntelliJ, in fact I'm told the AspectJ plugin is supposed to add support for it. There seems to be no other reference to this error online.
What am I doing wrong?

Gradle: Test Java library on Android

(I asked a similar question earlier, so I'll try a more general form and see if anybody knows how to do that.) There's a Java library to which I have added patches for Android support. I would like to automate testing of the code, but in order to check if it runs properly on Android, I need to test it on Android. The library artifact is a jar, though, not an AAR or an APK, so I don't want to remove the old build modes, and so far my attempts to add the Gradle Android Plugin yields errors like The 'java' plugin has been applied, but it is not compatible with the Android plugins.
How can I continue to produce a plain Java jar, but also automatically test it on Android? Do I need to, like, make a new submodule or something specifically for the tests?
Yes, usually it's a good practice to create a new module, say integration-tests, which in itself is an android library/app, and then you'd include your JAR/java lib in there and run android tests over it.

How to use SonarLint in Eclipse

I was assigned to use SonarQube for code quality. But while I'm downloading it's plugin to Eclipse I understood it is deprecated and new one is SonarLint.
But as so far I couldn't find any good documentation to how to use SonarLint. How to check java project using that. I only got touch with Youtube videos. But sadly they are really really unclear to me.
If can direct me to a good place to gain clear knowledge on this I'll be really grateful to you.
You can install SonarLint from the Eclipse Marketplace and read the official SonarLint documentation
If you want to analyze a complete project with the Sonar Lint plugin, you can trick the plugin by searching all Java files with a text editor and replacing "package" with " package". This will cause SVN or git changes. Open the "Sonar Lint Report" view and run the analysis on the "Current project". Afterwards, revert all your SVN changes. Do not run the analysis again as the Sonar Lint Plugin only analyzes changed files.
I found this helpful when I had no project on the Sonar server available.
You can install SonarLint as described by Sumit Singh.
Then you can link your project to a sonarqube server as described here
After that just make a change and save it. Sonarlint will automatically analyze the project for you. Cause analyzing is enabled by default (as far as i know)

Are there any Java-compilers that leverage an OSGi-environment instead of using the classpath?

Are there any ways to make javac use an existing OSGi-environment for the resolution of build-time dependencies instead of setting the classpath explicitely? I know I could write an OSGi-component that uses the Compiler-API of the JDK, but I think there should be a more straightforward solution.
Alternatively, if no such extension is available for javac, does ejc allow such a thing (usable from the command line; I'd be willing to accept an Equinox-only solution with ejc)?
ant task to compile using osgi.
http://www.ohloh.net/p/osgijc
or here now I guess?
http://code.google.com/p/eclipseosgitools/
Have you considered using Maven to manage dependencies? There are plugins available for IDEs like Eclipse. You just need to map the resource servers, and the needed libraries in a pom.xml, and that is pretty much it.
-Jay
You're missing out on the one obvious Java compiler that follows OSGi rules - Eclipse.
You can use Eclipse's compiler to do a headless build, but be warned, it's not for the faint-hearted.
Here's a simple tutorial on building with Eclipse and ant.
If you go down this path, I'd suggest looking at Tycho (the Maven sub-project for building OSGi stuff) and Buckminster, an Eclipse project.
I'm developing in the Lotus Expeditor Toolkit and Eclipse Plugin - It's a no-charge download. My build time and runtime classpaths are managed very easily by entries in the Manifests.
[disclaimer: I am an IBM employee.]

Problem checking out (from VSS) and building maven project in Hudson

I am new to Hudson, perhaps someone knows the solution:
I am trying to checkout the parent pom from the VSS in Hudson (vss plugin installed) and now I get class cast exception:
FATAL: hudson.maven.MavenModuleSetBuild cannot be cast to hudson.model.Build
java.lang.ClassCastException: hudson.maven.MavenModuleSetBuild cannot be cast to hudson.model.Build
at scm.vss.VSSSCM.checkout(VSSSCM.java:227)
at hudson.model.AbstractProject.checkout(AbstractProject.java:664)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:260)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:234)
at hudson.model.Run.run(Run.java:793)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:205)
at hudson.model.ResourceController.execute(ResourceController.java:70)
at hudson.model.Executor.run(Executor.java:88)
The line in question is here:
Build lastBuild = (Build)build.getPreviousBuild();
Has the interface changed? Anyone knows the solution?
Looks like Shashi filed this as Hudson issue 2665 which remains open.
Looks like it's a bug in that version of Hudson. Have you tried a slightly older or newer version? IIRC they provide very frequent stable builds, almost nightly...
I've never faced that situation, but I have faced other problems when using maven projects in hudson like infinite loops upon builds and so (that I think Hudson itself should evaluate and avoid). By this I mean that this feature is quitely young and error-prone.
Regarding at your exception, I can advise you to configure the project as a freestyle software project. If you set up the "Execute maven top-level targets" option on the build steps, the project will be built using Maven and probably the exception will dissapear.
The other thing that Hudson does automatically when a project is configured as a maven project is triggering builds for dependent project on successfull build, but, you also can configure it manually by using the "Build other projects" feature.
As you see, it's a little configuration price to pay and I strongly think that your exception will dissapear.
Hope it helps.
Carlos

Categories