首先,我对这个问题进行了研究,但没有找到任何解决问题的方法,所以我开始:
我正在尝试运行Apache / ActiveMQ发布订阅协议(2.5.0)的最新版本提供的一个示例。正如Apache所说,我试图在目录中运行mvn verify。问题是,它不起作用。我把输出放在这里,我尝试了-e和-X,所以请不要犹豫地问我这个堆栈跟踪的帖子。
(当然,/Library/./lib/modules不是目录,而是文件。实际上我不知道它能做什么,但我尝试重命名它并创建一个名为“模块”的文件夹,当我尝试运行其他内容时,它只会产生错误。)
[INFO] Scanning for projects...
[INFO]
[INFO] --------< org.apache.activemq.examples.mqtt:publish-subscribe >---------
[INFO] Building ActiveMQ Artemis MQTT Publish/Subscribe Example 2.5.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-maven) @ publish-subscribe ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-java) @ publish-subscribe ---
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) @ publish-subscribe ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ publish-subscribe ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/bouvet/ARTEMIS/apache-artemis-2.5.0/examples/protocols/mqtt/publish-subscribe/src/main/resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ publish-subscribe ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/bouvet/ARTEMIS/apache-artemis-2.5.0/examples/protocols/mqtt/publish-subscribe/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.024 s
[INFO] Finished at: 2018-04-23T16:17:15+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project publish-subscribe: Fatal error compiling: CompilerException: InvocationTargetException: java.nio.file.NotDirectoryException: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/modules -> [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编辑:我尝试将这个包含到我的pom.xml中:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>或者这个:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>但这并没有改变任何事情
编辑二:正如Justin Bertram所建议的,经过一些研究,我决定修改默认使用的JDK,至少在该项目中使用
export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_162`这可能不是最好的方法,因为我可能不得不再次更改它以使用Java 9,但至少它对此起作用。我现在有依赖的问题,但我认为这不是谈论这个问题的地方,我会认为这个问题已经解决了。
发布于 2018-04-23 19:10:16
看来您使用的是尚未支持的ActiveMQ 9。尝试使用Java 8,我想您将看到这个示例按预期运行。当我使用:
$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)https://stackoverflow.com/questions/49984022
复制相似问题