Maven compilation error: annotations are not supported in -source 1.3 

Joined:
08/13/2009
Posts:
172

September 08, 2009 03:23:39    Last update: January 09, 2010 23:40:45
For some reason the Maven compiler plugin defaults to Java 1.3. When compiling Java code with annotations, you get the following error:
annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)


Add the following section to your pom.xml fixes the problem:
<build>  
    <plugins>  
      <plugin>  
        <artifactId>maven-compiler-plugin</artifactId>  
        <configuration>  
          <source>1.5</source>  
          <target>1.5</target>  
        </configuration>  
      </plugin>  
    </plugins>  
</build>


Reference: Maven compiler plugin
Share |
| Comment  | Tags