Running IntelliJ Inspections via Gradle/TeamCity - java

I am attempting (unsuccessfully) to run IntelliJ Inspections on a java Gradle project in TeamCity. The documentation is a bit confusing; specifically, it states "To run inspections for your project, you must have either an IntelliJ IDEA project file (.ipr) or a project directory (.idea) checked into your version control." However, it also claims support for both Maven (see this post) and Gradle projects, which seems inconsistent with a requirement to commit the IntelliJ project files.
Our team prefers not to commit the IntelliJ project files, and therefore I am attempting to use my build.gradle file and an inspection profile. However, even for the simplest gradle project I can create, I am unable to get IntelliJ inspections to run successfully on TeamCity. Instead, I get this in the log:
[Step 2/2] [ 6968] WARN - .manage.ContentRootDataService - Can't import content roots. Reason: target module (ModuleData: module ':d9cc8a1592d04689:unspecified') is not found at the ide.
Am I attempting the impossible?

Related

Eclipse not able to recognise annotation

I have checked out a gradle project in eclipse but it is not able to recognise any annotation.Foe every annotation in each file it says
Configuration cannot be resolved to a
type
where configuration is annotation.
and all imports corresponding to annotation are also failing with following error:
The import org.springframework cannot be resolved
Entire project with all files is filled with error. But there is no such problem like this in Intellij for same project. Which setting am I missing for Eclipse ?
gradle build works fine although
From my experience, I did not see a checkout option in Eclipse for a Gradle project. I'm using Eclipse version 2019-06 (4.12.0). You need to check out the project in to your local file system and then do an import of the existing project as a Gradle Project.
Things to Note:
Make sure you have the Gradle buildship plugin installed in your Eclipse. (The plugin I use. Buildship: Eclipse Plug-ins for Gradle, provided as part of the Gradle Platform.)
Go to File --> Import. When a pop up box opens, scroll down to Gradle and select Existing Gradle project.
This Way Eclipse recognises the Gradle Project.

Intellij "cannot resolve symbol" after installing spring boot

I've recently installed the plugin "spring boot assistant" into my Intellij. When I was trying to run an old java file that I've completed before, a lot of the symbols were displayed as "cannot resolve symbol".
This is what my file looks like.
I think this might have something to do with maven, but I dont know how to fix it since there's no errors with running the program before installing spring-boot and maven. I've just started learning spring boot so I'm still unfamiliar with the functions. Please help me.
Some plugins might mess up with the project settings. First of all, try to invalidate cache: File -> Invalidate Caches / Restart.... Confirm with Invalidate and Restart. It takes a while but is worth a try.
If it doesn't work your SDK is not set: Open File -> Project Structure... and navigate to Project and add a Project SDK and the Project language level you need (you might want to navigate to your SDK saved in the system instead).
It is also worth to try checking up the language levels:
File -> Project Structure... and navigate to Modules.
Check the Language level of each module.
File -> Settings and navigate to Build, Execution, Deployment -> Java Compiler.
Check the Target bytecode version of each module.
It seems to have issues with resolving absolutely basic Java stuff - try going into Project Structure -> Project Settings -> Project and check if you have an SDK defined for your project.

Unable to run Maven project (gephi-app) the same way on NetBeans in IntelliJ

I am currently working on a project that involves utilizing Gephi's backend tools and frontend visualizers. For this, I have cloned Gephi's repository, https://github.com/gephi/gephi.git. The following tutorial walks users through how to clone and modify Gephi's sourcecode so that you may add "circle creation logic" to Gephi's visualizer, https://seinecle.github.io/gephi-tutorials/generated-html/working-from-the-source-en.html. I have found that running the project through NetBeans is a straightforward process, build the dependencies and run.
Unfortunately, such an option doesn't exist in IntelliJ and the maven "Lifecycle" goals that I can run (clean, validate, compile, test, package, verify, install, site, and deploy) build successfully, but does not actually run the project within the environment unlike NetBeans does. I am wondering what I am missing here, or how NetBeans can simply run the maven project node, but such an option doesn't exist in IntelliJ? How do I perhaps edit my run configuration within the IntelliJ IDE so that I can run such an instance?
The equivalent in IntelliJ IDEA would be the following:
Run the compile goal
Run nbm:cluster-app
Run nbm:run-platform
The last 2 goals are provided by the nbm Maven plug-in.
In IntelliJ IDEA they are visible under the Plugins node of the module in the Maven tool window:

Unable to import the Maven module in Intellij

I am trying to open this module in Intellij:
https://github.com/eugenp/tutorials/tree/master/javaxval
The steps followed by me:
Go to required directory javaxval/ in my local and
mvn clean install.
Open the pom.xml inside javaxval/ and open it as a project.
But Intellij is not syncing with the libraries mentioned in pom.xml as I can see in libraries section in Project Structure settings. Also, because of that, I can see lot of compilation errors.
Any idea what is the issue I am facing and how can I fix it?
This project imports and builds fine in IntelliJ IDEA 2019.2.2 version using the bundled Maven 3.6.1 for importing and JDK 1.8.
If it doesn't import/build for you, perform the diagnostics and check the logs as described in this answer. Make sure the parent pom file is present in the directory tree on your disk.

SonarQube Integration with Eclipse: Associate with SonarQube option not working for simple java project

I am trying to integrate sonarqube with eclipse to analyse simple java project.
But it is not happing. When we right click on simple java project and hit Configure-> Associate SonarQube, the window appear where field appear like Project and SonarQube project.
Project field is autopopulated with the java project you right clicked and What we need to enter in SonarQube project is not clear to me. Also no tab is appearing where we can do something like SonarQube -> Analyse.
(I have added sonaqqube plugin in eclipse and also set sonarqube server path to localhost:9000)
Please suggest.
The SonarQube Eclipse plugin lets you associate (and locally analyze) projects that have already been analyzed by other means (maven target, ant task, SonarQube runner). It is not meant as a way to launch persisted (shared) analyses.
So if you want to use the SonarQube Eclipse integration, please do a first analysis of your project, then try to associate it from Eclipse. This will allow you to synchronize the issues and perform local (preview) analyses.
[EDIT]
On recent (4.x) versions of SonarQube, you also have the option to provision your project on the server. This will allow you to associate your Eclipse project and perform preview analyses.

Categories

Resources