[英]Open JDK 11 and javah in pom.xml
I switched my java version from java 8 to java 11 , and it seems that in java 11 javah is removed from JDK bin folder, before I was executing the javah command in my pom.xml like below我将我的 java 版本从 java 8 切换到 java 11 ,似乎在 java 11 中 javah 已从 JDK bin 文件夹中删除,然后我在 pom.xml 中执行 javah 命令,如下所示
<execution>
<id>javah</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>javah</executable>
<arguments>
<argument>-classpath</argument>
<argument>${project.build.outputDirectory}</argument>
<argument>-d</argument>
<argument>${build.path}/include</argument>
</arguments>
</configuration>
</execution>
Since javah has been removed from JDK 11 how can I replace the above javah command with javac -h in my pom to work with java 11由于 javah 已从 JDK 11 中删除,如何在我的 pom 中将上述 javah 命令替换为 javac -h 以使用 java 11
The error I get is我得到的错误是
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (javac -h) on project myProject: Command execution failed.: Process exited with an error: 2 (Exit value: 2)无法在项目 myProject 上执行目标 org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (javac -h):命令执行失败。:进程退出并出现错误:2(退出值:2)
Any idea?任何想法? Thanks
谢谢
You should modify your execution as :您应该将执行修改为:
<execution>
<id>javach</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>javac</executable>
<arguments>
<argument>-classpath</argument>
<argument>${project.build.outputDirectory}</argument>
<argument>-h</argument>
<argument>${build.path}/include</argument>
</arguments>
</configuration>
</execution>
based on the the javac --help
基于
javac --help
-h <directory> Specify where to place generated native header files
Here is another way to generate the sources, this time by adding on to the maven-compiler-plugin
:这是生成源代码的另一种方法,这次是通过添加到
maven-compiler-plugin
:
<compilerArgs>
<arg>-h</arg>
<!-- where to put include files (change to whatever) -->
<arg>${project.basedir}/src/main/c++/include</arg>
<arg>-d</arg>
<!-- where to put the generated .class files (probably don't change this) -->
<arg>${project.build.outputDirectory}</arg>
</compilerArgs>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.