Toby Eggitt
Toby Eggitt

Reputation: 1872

Module default language level in IntelliJ IDEA maven project?

EDIT: I've determined that my configuration works fine for IDEA format projects, but only fails in the curious way noted below for maven projects. But since that's what I need, I'd really like to get this resolved :)

Please note, I do not think this is the duplicate that's been suggested. the referenced question describes how to change an individual project's configuration. I can do that, but it's not what I want to do. I want to change the default settings when a brand new project is created (note also, I said created, not imported, as one item in that referenced question discusses.) Please either explain how that (exceedingly long, and therefore hard to follow) question answers my specific question, or please remove the "duplicate" flag.

I've checked many questions here that seem related, and the docs (https://www.jetbrains.com/help/idea/working-with-sdks.html) but I must be missing something, as things are not working as I interpret they should be. Specifically, I (believe I) have configured my Default Settings for Java 1.8: enter image description here

And similarly, my Default Project Structure: enter image description here

And according to the docs and that screenshot, this should set the language level default for all project modules.

However, if I create a new project (maven project, in case it makes any difference) and (by default) tell it to use 1.8:

enter image description here

The resulting project structure still defaults to using 1.5 as the language level for modules:

enter image description here

Even though the project picked up on the 1.8 setting:

enter image description here

Can anyone tell me what I missed? (Please note that I create a lot of small projects for demonstration purposes, and if I have to configure this manually in every single case, that would really make me rethink my plan to migrate to IntelliJ.)

TIA!

Upvotes: 1

Views: 781

Answers (1)

Toby Eggitt
Toby Eggitt

Reputation: 1872

This is not what I'd hoped for, but it seems that this is an interaction with maven. Because the pom generated for an "empty" maven project does not specify maven.compiler.source/target, the modules, but only the modules, of the project are forced to Java 5 (even though IntelliJ claims that the rest of the project is in some sense Java 8 or 9).

I suppose this is "just the way the components interact" and most folks are building corporate projects with pre-existing pom files, but it seems like an oversight in the defaulting. After all, when I went through the "new maven project" wizard, I told it that I wanted a Java 8 project. Would it be terribly difficult to tweek the pom to suit.

Check one point to NetBeans in this case.

Upvotes: 2

Related Questions