tags:

views:

28

answers:

1

Possible Duplicate:
compiling project with jdk1.5 using maven2

I am trying to build java project that is using java 5 features, so maven is understandably returning an error message:

... variable-arity methods are not supported in -source 1.3 
(use -source 5 or higher to enable variable-arity methods) ...

Could somebody help me understand:
- Why maven is not compiling against only installed jdk that is 6?
- How can I configure it to compile against a different jdk ie, 5 or 6?
- Do I need to install maven enforcer plugin whose only beta is available to date?

Thanks in advance

+1  A: 

I really wish Maven would not default to Java 1.3 compiler settings.

Here is what I put in all my POM files:

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

Please anyone tell me that there is a better way.

Thilo
Great. It works at least
Leslie Norman