问题
I'm attempting to run my Maven build using the usual:
mvn clean install
I'm getting a whole series of errors that read:
annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
How do I use -source 5 when performing the build. My JAVA_HOME is pointing to JDK 1.6.
回答1:
Add this to your pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
It is also documented in the Maven FAQ.
For further information take a look at the Compiler Plugin documentation.
回答2:
it's in the pom.xml. you should have <source>1.3</source>
change it to
<source>1.6</source>
来源:https://stackoverflow.com/questions/5163872/using-different-java-source-version-when-running-maven2-build