I have a multi-module project which is amidst migration process. I cannot compile some dependent module and thus it's hard to track dependency/resolving errors without explicitly opening each and every file to be checked by the editor.
I created code inspection profile which can show me syntactic errors and but I'm not able to configure it to show everything that should be red-underlined (like e.g. Eclipse problems window).
Related
When updating an external jar file which contains breaking changes, so the code at certain points will have errors (which happens and is fine), I am unable to build my project via gradle, thus EVERY import from the jar shows up in my IDE as an error (Intellij).
This makes it super hard to actually see where the errors are, since ALL imports from the jar, even though all those classes are in there show up as "errors", since build failure means gradle simply wont import the jar at all...
The end result is that my IDE shows things like this (removed package name for security reasons):
All of those model.entity classes ARE in the jar, but gradle wont import them because the build process stops at the first syntax error in the code...
Is there any way around this? How to refactor large code bases without relying on the error messages inside the gradle console (which there might be a LOT of).
I'd like to import the jar first THEN fix the syntax errors? Maybe a different gradle command? I'm simply using "clean build"
There are 2 aspects here.
grade
IDE (appears to be Intellij) - imports the gradle to create project. unless on auto refresh, requires manual reimport (refresh button) when there are changes in gradle files
in your scenario, initial state is gradle build works, Intellij works fine
you replace the dependency with 'breaking' change.
gradle build - will fail at compile stages as code is yet to the fixed
IntelliJ - still is not seeing new dependency. click the re-import
The import will always succeed unless there are errors in .gradle files
After import IDE will now reflect new dependency
I recently moved from Eclipse to IntelliJ and I was really used to see any kind of warnings in the tree of my project in eclipse.
I think in IntelliJ by default compilation errors are displayed in the project tree or maybe it worked by enabling the "build project automatically" setting. But I did't find any way to enable the same for simple warnings (e.g. unused imports).
Does somebody know how I could achieve this or anything similar to it so I can simple get informed about any warnings?
I would be happy about any help I can get
Most inspections run in the background only for the currently open file for the performance reasons, therefore there is no way to mark the files with inspection warnings in the project view.
Use Analyze | Inspect Code to get the list of the files with warnings.
I have a large project with several modules including one large "src" module, and each compilation takes at least 5-10 minutes. I'm unable to refactor the structure of the project to potentially speed up compilation.
Every time I try to run a JUnit test, IntelliJ always compiles the entire module before running the tests (even if no files changed).
Other answers suggested using the Eclipse compiler and the "Make, no error check" launch command instead of the regular "Make". I tried that but IntelliJ is still rebuilding the entire module.
Edit: This seems to be related to how errors and handled with "Make, No Error Check". My project contains errors in unrelated areas of the code (managed by other teams) that I was using the eclipse compiler to skip over. After "fixing" those errors, incremental compilation works again. Maybe the build is considered invalid (and is discarded) even if errors are skipped?
Change your run configuration to not make the module:
Go to Run -> Edit Configurations (or click the Edit Configurations from the Run dropdown menu), and you'll see this screen:
Remove "Make" from Before launch, and it should work
P.S. I would suggest renaming it to something like: JUnit tests (NO REBUILD) otherwise you might be in for some serious head-scratching later on :)
I'm using a java annotation processor to generates additional classes at compile time. It works fine when building with gradle, but I can't get IntelliJ to recognize the generated classes. Whenever I try to build the project in IntelliJ, it errors saying that it can't find the symbols that refer to the generated class. In the same vein, since it doesn't know about the classes, it's not giving me any help in writing code that uses the classes, and just highlights it all as an error.
I have two sibling modules: the "processor" module implements the annotation processor and defines the annotations. The "demo" module is just some JUnit tests to try out the annotation processor. I can build the "processor" module in IntelliJ fine, but the "demo" one gives me the errors as described above. I've got "processor" as a dependency of the "demo" module, at the "Test" scope (I've also tried "Compile" scope).
How can I get IntelliJ to recognize the classes automatically?
Update
I've been able to get it to build by creating a new profile under "Annotation Processors" in the settings dialog, moving the "demo" module under that profile, enabling annotation processing for that profile, and specifying the FQCN of the annotation processor under the "Annotation Processors" list box.
However, the live code help still isn't working, the editor just tells me it can't find the class, which is really more important (because I could always build from gradle).
In IntelliJ, find the folder that the generated code goes in. This is controlled by settings on the same dialog as where you set up the annotation processing. Right click on that folder, find "Mark Directory As" in the context menu, and choose "Generated Sources Root".
After doing this, IntelliJ will recognize and handle the generated classes normally. It will also give a compile warning that an output path intersects with a source root, but that's reasonably ignorable. I haven't been able to find a way to get rid of that warning without also leaving the generated classes unrecognized.
You can go on pom/gradle file and Reload it again, it will work.
example :
pom.xml(right-click)-> Maven-> Reload
I get the types Java Snippet Marker and BPEL Editor Problem Marker in my Java workspace. Those projects have access to external jars and the correct runtime (Websphere Process Server) and I'm not sure what it's complaining and the solution.
Try a clean build, sometimes the auto build will not be proper and it'll cause these kinds of errors to show up. You can also check the projects properties to make sure it has the proper rumtime and libs attached to it