Mvn clean install using java 1.5 or 1.6

When I do mvn clean install, I get this error:

annotations are not supported in source 1.3 (try -source 1.5 to enable annotations)

But where can I put this command -source 1.5? I tried all permutations with mvn clean install and couldn't get it to work. Therefore, I tried to compile in my pump, for example:

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

But that didn't work either. What am I missing? Thank!

+3
source share
2 answers

The latest version of the compiler plugin is 2.3.2. This version seems to support 1.6 both the version and the target parameter.

+1
source

, , maven.compiler.source maven.compiler.target pom.xml:

<project>
   ....
   <properties>
       <maven.compiler.source>1.5</maven.compiler.source>
       <maven.compiler.target>1.5</maven.compiler.target>
   </properties>
0

Source: https://habr.com/ru/post/1776003/


All Articles