Dark theme | Light theme

April 1, 2009

Change source version for Maven compiler plugin in NetBeans

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 1.5.

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: