fatal error compiling invalid flag --module-path

后端 未结 1 1670
野趣味
野趣味 2021-01-02 01:46

I have a project. Originally it was a single module project with structure like this

java-cloud-sample\\
    src\\
        main\\
            java
    pom.xm         


        
1条回答
  •  -上瘾入骨i
    2021-01-02 02:04

    This failure occurs when maven installed on your machine is configured with java8 as the default java version. You can confirm this by executing

    mvn -version
    

    on your terminal and checking the Java version stated in the configuration.

    To resolve the version to a newer and supported version like java9 at the moment, you can create/edit the mavenrc(on MacOS) file on your machine:

    vi ~/.mavenrc
    

    to include these

    export PATH
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/
    export PATH=${PATH}:$JAVA_HOME/bin
    

    Once you save this configuration, you can confirm maven should be using Java version 9 using the same command and then your project shall build without the stated error.

    0 讨论(0)
提交回复
热议问题