IDEA sees errors in pom.xml files and can't set Java version

已回答

I have a project based on a Maven aggregator like this:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bp.gem</groupId>
<artifactId>aggregator</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<module>../shared-parent-pom</module>
<module>../my-configuration</module>
<module>../my-utilities</module>
<module>../my-security</module>
<module>../my-web-server</module>
</modules>
</project>

The aggregator project is simply this pom - it's not even checked into VCS.

I used the VCS menu to check out he other projects from version control and Intellij added them automatically as modules to the project.

All the poms in all the project / modules have a problem highlighted on their <project> tags - "org.jetbrains.idea.maven.server.embedder.CustomModelValidator......"  (shortened, but I doesn't explain much) - and there are 12 compilation errors due to Java 1.5 since Intellij is ignoring the pom maven-compiler-plugin config for 1.8.

Remedial Actions tried

I scrapped the whole Intellij setup on my workstation, invalidated and restarted the caches, and checked out the Java code and poms from VCS, and set it all back up in Intellij again.

Intellij during the creation of the modules even asked me to set the Java version level, which I did, to 1.8. 

The pom.xml errors and compilation errors re-appeared.

I just upgraded to 2017.2 today, but the problem persists.

 

 

0
Avatar
Permanently deleted user

0
Avatar
Permanently deleted user

Hi Serge, 

I have never had to do that before and in fact as I mentioned above, IntelliJ already showed me one dialog to choose the JDK version when I re-created the project. However I followed the instructions on the SO answer to the letter, filling in 1.8 in about 4 different places and adding 

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

to the parent pom. 

Now the issue has worsened and the compiler is having problems resolving some of the dependencies. In maven it's fine, although IntelliJ still sees the errors there.

The most recent change I can attribute this to is that I separated out the aggregator functionality from the parent pom so it is truly independent. The individual maven projects are children of the 'shared-parent-pom' and modules of the 'aggregator' pom. All are on the same directory level. 

0

If you have a reproducible test case, please report a bug at https://youtrack.jetbrains.com/issues/IDEA and attach it there.

0

请先登录再写评论。