Tom van den Bogaart
Tom van den Bogaart

Reputation: 143

Compiling Maven Gives Me Multiple Errors

I'm trying to use maven on my project but i'm getting this error everytime and dont know how to fix it.

Below are all my settings :

Java Versoin:

C:\Users\TomBo\Downloads\AnimalShelterJavaGUI>java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

Maven Version:

C:\Users\TomBo\Downloads\AnimalShelterJavaGUI>mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11- 
10T17:41:47+01:00)
Maven home: C:\Users\TomBo\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch- 
0\183.5429.30\plugins\maven\lib\maven3\bin\..
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.8.0_181\jre
Default locale: nl_NL, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "x86", family: "dos"

Maven Compile:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AnimalShelterJavaGUI 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ 
AnimalShelterJavaGUI ---
[INFO] Deleting C:\Users\TomBo\Downloads\AnimalShelterJavaGUI\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ 
AnimalShelterJavaGUI ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered 
resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ 
AnimalShelterJavaGUI ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, 
i.e. build is platform dependent!
[INFO] Compiling 14 source files to 
C:\Users\TomBo\Downloads\AnimalShelterJavaGUI\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.965 s
[INFO] Finished at: 2019-03-12T13:34:04+01:00
[INFO] Final Memory: 7M/20M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler- 
plugin:3.8.0:compile (default-compile) on project AnimalShelterJavaGUI: 
Fatal error compiling: invalid flag: --module-path -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

These are the compiling results

My JAVA_HOME dir:

enter image description here My POM.xml file:

<groupId>groupId</groupId>
<artifactId>AnimalShelterJavaGUI</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
    <openfxVersion>11.0.2</openfxVersion>
    <codeVersion>11</codeVersion>
</properties>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <release>${codeVersion}</release>
                <source>${codeVersion}</source>
                <target>${codeVersion}</target>
            </configuration>
        </plugin>
    </plugins>
</build>    

I want to work with this because im going to work with jenkins. Hope you guys can help me out.

Upvotes: 0

Views: 362

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35843

I guess you have the wrong JDK on the PATH, because your java -version shows Java 8, while you try to compile with Java 11.

Check your PATH variable.

Upvotes: 2

Related Questions