The Maven compiler plugin allows us to change the source version of the Java files for compilation. If we want to use all the latest support, like assertions, we must set the version to at least
1.4. If we want to use annotations we must set the value to at least
In NetBeans we can change this in the Project Properties window. We right-click on our Maven project and select Project Properties. In the Sources tab we can change the Source/Binary Format to the version we want.
NetBeans add the compiler plugin to the
pom.xml with the selected version:
<build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>