How to set execution environment and target environment JRE in maven projects

 

By default when we create a maven project, it is configured to use JRE5 and will try to find a compatible JRE/JDK. Hence If you are using eclipse IDE, you will find below warning in “Markers” tab.

Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.

If your source and target JDK is other than JDK5, then you can make use of below maven plugin configuration to resolve this issue.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.2</version>
  <configuration>
    <source>1.8</source>
    <target>1.8</target>
  </configuration>
</plugin>

Here I’m trying to set the source and target to JRE-1.8 and I’ve this JRE configured in my eclipse.

Leave a Reply

Your email address will not be published. Required fields are marked *