Setting Compiler Level For Maven

For some reason Maven 2 does not have JDK 1.5 set as its default compiler level.  Since I’ve run into this problem a few times, I figured I would document the solution.

This will need to be added to the root POM of your Maven project:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>

You can also add this into an “active by default” profile in your settings.xml, located in either your .m2 directory or your install directory.

Advertisement

2 Comments »

  1. Marcos said

    Thank you very much, it helped me a lot!

  2. scipper said

    helped me too! thx

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.