【发布时间】:2020-09-03 17:50:52
【问题描述】:
我看到了很多关于这个问题的答案,但它们对我不起作用。我在我的 PC 上安装了 Visual Studio Code、最新版本的 Java 和 Maven,并且能够在 PC 上使用 Maven 成功构建我的应用程序。然后我在我的 Mac 上执行了相同的步骤,我得到了这个错误。
Macos、Visual Studio Code、Maven 和 Java 的新版本。就像所有其他人所说的那样,我将这些行添加到我的 pom.xml 文件的属性部分:
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
仍然得到同样的错误。以下是 mvn build 的相关输出:
alberts-mbp:com.versabuilt.rushmore.process albertyoungwerth$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ---------< com.versabuilt.rushmore.process:VersaBuiltProcess >----------
[INFO] Building VersaBuilt Process 0.2.18
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ VersaBuiltProcess ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ VersaBuiltProcess ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 10 source files to /Users/albertyoungwerth/rushmore/com.versabuilt.rushmore.process/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Source option 6 is no longer supported. Use 7 or later.
[ERROR] Target option 6 is no longer supported. Use 7 or later.
[INFO] 2 errors
我也重新启动了 Visual Studio Code,但无济于事。
【问题讨论】:
-
您安装了哪个版本的 Java?我猜测 Java 6。但我不知道。
-
在你的电脑上查看
java -version,查看VS代码中的JVM配置。 -
在您的问题中包含
mvn和javac的版本是值得的 - 只是说新版本没有帮助。如果您可以提供指向示例项目的链接,也很有用。 -
java版本“14.0.1”2020-04-14
-
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven 主页:/Applications/apache-maven-3.6.3 Java 版本:14.0.1,供应商:Oracle Corporation,运行时:/Library/Java/JavaVirtualMachines/ jdk-14.0.1.jdk/Contents/Home
标签: java macos maven visual-studio-code