This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Currently, when you set the source/binary format of a Maven project via the project properties, it adds something like this to your "pom.xml" file: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> Consider instead using this form where possible: <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> The latter version has the advantage that you don't have to explicitly specify the Maven compiler plugin version, providing more flexibility in some parent/child pom setups. I imagine if a pom file already specifies a compiler plugin version which predates this property (the Maven docs say it has been there since 2.0), you'll need to fall back to the original method. Of course, if there's some reason I'm not thinking of where the current method is a better choice, feel free to close this. The only reason I can think of is if older plugin versions don't support newer JDKs (I don't see why they would not).
I should mention that Netbeans Maven projects already seems to understand the latter format if you manually add it to your pom file.
we explicitly write the <configuration> section as that's the most deterministic thing to do. Once <configuration> parameter is written somewhere (this pom, any of the parents, profiles etc) the property maven.compiler.source will *not* be used. So we are defending against writing a value that's not picked up by the resolved model (making it a noop). in general writing to pom in a way that is both generic and observant to what's already written in the pom (and the parents) is fairly hard and we try to avoid it.
This issue is resolved, isn't it? When I create a new Maven project, it has the section: <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties>
Yup.