NotDirectoryException on maven compilation of ActiveMQ Artemis example
NotDirectoryException on maven compilation of ActiveMQ Artemis example
首先,我研究了这个问题,但没有找到任何解决办法,所以我开始了:
我正在尝试 运行 最新版本的 Apache ActiveMQ Artemis (2.5.0) 提供的示例,即 protocols/mqtt/publish-subscribe。正如Apache所说,我试图在目录中运行 mvn verify
。问题是,它不起作用。我把输出放在这里,无论如何我都尝试了 -e 和 -X 所以不要犹豫问我这个堆栈跟踪的 post。
(当然,/Library/[....]/lib/modules 不是目录,而是文件。我其实不知道它的作用,但我尝试重命名它并创建一个名为 '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,但至少它适用于此。
我现在有依赖性问题,但我认为这不是谈论它的地方,我会认为这个问题已经解决了。
您使用的似乎是 Java 9,Apache ActiveMQ Artemis 尚不支持它。尝试使用 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)
首先,我研究了这个问题,但没有找到任何解决办法,所以我开始了:
我正在尝试 运行 最新版本的 Apache ActiveMQ Artemis (2.5.0) 提供的示例,即 protocols/mqtt/publish-subscribe。正如Apache所说,我试图在目录中运行 mvn verify
。问题是,它不起作用。我把输出放在这里,无论如何我都尝试了 -e 和 -X 所以不要犹豫问我这个堆栈跟踪的 post。
(当然,/Library/[....]/lib/modules 不是目录,而是文件。我其实不知道它的作用,但我尝试重命名它并创建一个名为 '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,但至少它适用于此。 我现在有依赖性问题,但我认为这不是谈论它的地方,我会认为这个问题已经解决了。
您使用的似乎是 Java 9,Apache ActiveMQ Artemis 尚不支持它。尝试使用 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)