下载 dl4j 示例时出现 MAVEN 错误

标签 maven java-9 intellij-14 dl4j

在我问这个问题之前,让我先说我对 DL4J、maven 和 java 完全陌生,所以请忍受我的愚蠢问题。

我正在尝试使用 mvn clean install 安装 dl4j-examples命令,但我收到以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project datavec-examples: Fatal error compiling: java.lang.NoClassDefFoundError: com/sun/tools/javac/file/BaseFileObject: com.sun.tools.javac.file.BaseFileObject -> [Help 1]

现在我不明白的是我是因为 java 还是 maven 而收到这个错误?

完整的堆栈错误是:
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:97)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[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/NoGoalSpecifiedException

我在 Windows 10(64 位)上运行以下版本的 java 和 maven
Picked up _JAVA_OPTIONS: -Xmx512M
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T12:58:13+05:00)
Maven home: C:\apache-maven-3.5.2-bin\apache-maven-3.5.2
Java version: 9.0.4, vendor: Oracle Corporation
Java home: C:\Progra~1\Java\jdk-9.0.4
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

这是我的环境变量的屏幕截图:

enter image description here

enter image description here

最佳答案

这可能与 Lombok(由 dl4j 使用)和 jdk 9 兼容性问题有关。如果您可以切换到 jdk 8,它应该可以工作。 (或将 lombok 版本更改为可以与 jdk 9 一起使用的版本。我建议第一个解决方案)

关于下载 dl4j 示例时出现 MAVEN 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48607659/

相关文章:

java - Tomcat web项目部署

java - 为什么我的 Maven 插件不在构建生命周期中运行?

scala - Intellij : SBT-based Scala project does not build with Java 9

java - Intellij 无法设置 VM 选项

java - Play 2.1.1 构建依赖

maven - Hadoop-common、Hadoop-core 和 Hadoop-client 之间的区别?

java - jshell - 无法找到 printf

java - 如何使用 Gradle 制作多版本 JAR 文件?

java - 如何在intellij中更改java源

scala - 如何让 Intellij 对失败的测试提供文本差异比较