Java: Compilation failed: internal java compiler error with javac on Intellij

Hi everyone,

I wanted to know if anyone using IntelliJ could compile Orekit using the javac compiler ?

On my end, i can compile it just fine until release 10.1 with the introduction of the DefaultDataContext which seem to be the cause of my compilation error in addition to a huge penalty in compilation time when using Eclipse compiler.

For now i must switch to the eclipse compiler but it is a bit of a bother to change that everytime my configuration is reset :sweat: .

Cheers,
Vincent

Hello,

I always use Eclipse mode, Javac doesn’t work. Intellij seems to randomly switch back to the latter, annoying indeed.

Cheers,
Romain.

Ok i may have found something, it seems that we need to define the path to the Annotation processors in Build,Execution,Deployment → Compiler → Annotation processors.

However and by default, the IDE doesn’t find the path even though the pom indicates to look inside :

              <includes>
                <include>org/orekit/annotation/**</include>
                <include>org/orekit/compiler/**</include>
              </includes>

Hence i think we need to fix the pom but still have not found how. I have been trying several fix with
<annotationProcessors>but nothing worked so far.

Cheers,
Vincent

I use IntelliJ. I didn’t know about choosing Eclipse mode, so I assume I’m using javac mode? Running individual tests from the editor works fine. Some things that help are:

  • Explicitly use a 1.8 JDK (which I’m sure you already do) in the project settings
  • Use maven to perform a “clean” and “compile”
  • Right-click on the “compiler” folder (which contains the DefaultDataContextPlugin) in the project outline and select “Mark directory as → Excluded”

Hi @markrutten,

I have followed your instructions but unfortunately still encounter the same error. Could you check on your side as well @Serrof ?

I’m using java 1.8.0_362.

Cheers,
Vincent

For me the maven compile fails due to Hipparchus’ snapshot status.

Are you sure Mark that you’re not in Eclipse mode?

Cheers,
Romain

Strange, don’t you have a local snapshot of Hipparchus installed ?

I think I managed to have this running.
My current settings allowed me to have several JetBrains Idea projects (not JetBrains Idea modules) that depend on each others, and to have the compiler plugin work.

This was done by letting JetBrains Idea match the Maven projects hierarchy, as it can link projects together, and also delegate compilation to an external maven program.

So here is what I did.

  1. I started by cloning manually the various projects within one global directory using git clone, so I ended up with base-directory/hipparchus, base-directory/orekit, base-directory/my-application
  2. then from either the Open button on the JetBrains Idea welcome window or from the File → Open top level menu, I just opened the base-directory/hipparchus/pom.xml file and clicked on the Open as project button in the popup, this created the hipparchus project with its many maven modules
  3. from the File → Open top level menu, I then opened the base-directory/orekit/pom.xml file and clicked on the Open as project button in the popup, this created the orekit project
  4. from the File → Settings top level menu, I navigated in the Settings popup and selected Build, Execution, Deployment → Build Tools → Maven → Runner,
  5. in the Runner settings, I selected both Delegate IDE build/run actions to Maven and Skip Tests

Then, when I run Orekit tests, it is maven that builds the library, but it does not run the tests, JetBrains Idea runs them. Not selecting Skip Tests just means the tests would be run twice, once by maven and once by the IDE.

In order to compile and run my application, I just did step 3 again with my application pom.xml. Note that delegating the build to maven is project-specific, so I did it only for Orekit (i.e. the intermediate level, between Hipparchus and my application), for the other projects, I just let Jetbrains Idea do the compilation using its embedded maven tools.

In my case, as I also wanted to be able to modify all projects, I linked them together. This is done for example in Orekit by selecting View → Tool Windows → Maven in the top level menu, and in the maven tool window that appears, click on the big + button with the Add Maven Projects tooltip and select the top level base-directory/hipparchus/pom.xml file, and performed something similar in my application that depends on both Hipparchus and Orekit. So when I switch Orekit to some branch I am working on and rebuild it, I can use it in my application because it follows the maven dependencies properly.

2 Likes