Reputation: 1299
I'm getting an error saying
(use -source 5 or higher to enable annotations) {class path} error: for-each loops are not supported in -source 1.3
when I try to compile a module using maven.
The thing is that the java version in my machine is 1.7.0_02
Can anyone suggest a solution?
Upvotes: 1
Views: 690
Reputation: 781
<build>
<finalName>your project name</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
Upvotes: 0
Reputation: 1
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<compilerArgument></compilerArgument>
</configuration>
</plugin>
</plugins>
</pluginManagement>
by blackpanther
this other too
<project>
....
<properties>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
</properties>
by rzymek
all together
and clean and build the proyect and that's work fine vatos!!!
Upvotes: 0
Reputation: 9301
The shortest version is to set maven.compiler.source
and maven.compiler.target
properties in your pom.xml:
<project>
....
<properties>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
</properties>
Upvotes: 0
Reputation: 1
Please, check the value of the JAVA_HOME environment variable.
For the user acc which is used by maven
Upvotes: 0
Reputation: 11486
You may want to include this in your pom.xml file as I had the same problem:
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument></compilerArgument>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Upvotes: 8