Reputation: 12859
Our source code is still Java 8 complient, but we have two different builds: one built with JDK 11 and module-info.java
. And one with JDK 8 and without module-info.java
. With maven, this is easy two accomplish with to different profiles. For the JDK 8 profile, module-info.java
is excluded:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
...
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</plugin>
When this project is imported into Netbeans 11 and the correct profile activated, the maven configuration for excludes
is ignored.
Upvotes: 1
Views: 1553
Reputation: 145
In case anybody stumbles upon this issue, I've indicated here why it (probably) doesn't work:
Migrating maven project to modules - ignore module-info.java
Upvotes: 1
Reputation: 4591
Make exclusion a part of base configuration.
<pluginManagement>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
...
<excludes>
<exclude>**/module-info.java</exclude>
</excludes>
</configuration>
</plugin>
and override exclusions in java-11 profile
<profile>
<id>java-11</id>
<pluginManagement>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes combine.self="override"/>
</configuration>
</plugin>
Upvotes: 1