1

I am using Maven for the first time (in Eclipse). I would like to include HakariCP to my project. Every time I try to build my project I get following error message:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project WindowPanel: Fatal error  compiling: invalid target release: 1.8 -> [Help 1]

Here is my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>me.gustavwww</groupId>
  <artifactId>WindowPanel</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>WindowPanel</name>
  <description>A Windows Server Panel</description>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <id>spigot-repo</id>
      <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>org.spigotmc</groupId>
      <artifactId>spigot-api</artifactId>
      <version>1.10.2-R0.1-SNAPSHOT</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.zaxxer</groupId>
      <artifactId>HikariCP</artifactId>
      <version>LATEST</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>

Thanks in advance!

EDIT: All I did was update my JDK to the latest version.

Janez Kuhar
  • 3,705
  • 4
  • 22
  • 45
Dondaj
  • 35
  • 10

2 Answers2

3

If you have JRE set to 1.7 by default in Eclipse you need to specify 1.8 in the Run Configurations. Go to "Run > Run Configurations..." and select the Maven Build you have problem with. Then click the JRE tab and choose Execution Environment Java 1.8.

Adam Nybäck
  • 845
  • 7
  • 13
0

If you really need to compile it against Java 8, read this question and answer.

They provide more than one to way to force Maven to use a specific version of Java.

marcelovca90
  • 2,673
  • 3
  • 27
  • 34