我有下面的POM文件,我需要把它转换成gradle,但是我卡住了,我怎么把Javah任务写进gradle呢?
<executions>
<execution>
<id>javah</id>
<phase>generate-sources</phase>
<configuration>
<javahOS>linux</javahOS>
<javahProvider>default</javahProvider>
<javahOutputDirectory>${project.build.directory}/custom-javah</javahOutputDirectory>
<workingDirectory>${basedir}</workingDirectory>
<javahOutputFileName>MegJniWrapper.h</javahOutputFileName>
<javahClassNames>
<javahClassName>com.abcdefgh.engine.common.meg.MegJniWrapper</javahClassName>
</javahClassNames>
</configuration>
<goals>
<goal>javah</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>发布于 2015-05-01 09:02:26
非常粗糙,但足以让你入门,我假设javah会生成代码。
ext {
// define directories here
// ex. genSrcDir
}
configurations {
javah
}
// here you want to include it in your sourceset so that if compileJava gets call your generated code will also compile (don't know if that applies to javah)
// ex. sourceSets.main.java.srcDir genSrcDir
dependencies {
// put javah dependencies here and use javah as configuration
// ex. javah dependency.jar
}
task javah () {
description = 'javah task'
// put optional inputs.dir and outputs.dir here so gradle can skip if nothing changes
doLast {
// javaexec here to call the javah
}
}
compileJava.dependsOn javah
task generateSource (dependsOn: javah) {
description = 'Javah'
}https://stackoverflow.com/questions/29975418
复制相似问题