0

Im trying to build use maven from the terminal, and am getting the following error:

[ERROR] (use -source 5 or higher to enable annotations)

The strange thing is, in my pom I have the following:

    <properties>
...
        <java.version>1.7</java.version>
...
    </properties>

and

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.2</version>
      <configuration>
      <source>${java.version}</source>
      <target>${java.version}</target>
      </configuration>
</plugin>

When I run maven install from within eclipse it works.

When I run mvn --version from the terminal, here is the output:

Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_72, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-24-generic", arch: "amd64", family: "unix"

I noticed too, that when running from the terminal, there is the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project

So, for some strange reason it is using an older version of the compiler plugin when running from the terminal.

Anyone know why this error is occurring, and how to fix it?

Magick
  • 4,603
  • 22
  • 66
  • 103
  • If you ever had defined the maven-compiler-plugin version but the error messages gives me the hint that it is not the case. The question is where does the other version is coming from ? – khmarbaise Nov 22 '14 at 16:59

1 Answers1

0

Found the answer on Maven plugin version in pom (seemingly) ignored

Using the following fixed it:

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.1</version>
    </plugin>
  </plugins>
</pluginManagement>
Community
  • 1
  • 1
Magick
  • 4,603
  • 22
  • 66
  • 103