Adding C++ JNI using nar-maven-plugin to an existing Spring Tools Suite (STS) project using Java 1.8.0_45, Maven 3.3.3, nar-maven-plugin 3.2.3 on OSX Yosemite 10.10.3, I get the following error for the javah goal:
[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.2.3: \
nar-javah (default-nar-javah) on project archivist: \
JAVAH: Class could not be inspected: Invalid byte tag in constant pool: 18 -> [Help 1]I've paired down my native class to the basics:
package com.zorroa.archivist.processors;
public class CaffeProcessor {
public final native int test();
CaffeProcessor() {
System.out.println(test());
}
}Here are the diffs for my pom.xml from the existing STS version:
diff --git a/pom.xml b/pom.xml
index a62a27e..08fe118 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.zorroa</groupId>
<artifactId>archivist</artifactId>
<version>1.0.0</version>
- <packaging>jar</packaging>
+ <packaging>nar</packaging>
<name>zorroa-archivist</name>
<description>Demo project for Spring Boot</description>
@@ -102,15 +102,55 @@
<artifactId>hazelcast</artifactId>
<version>3.4.2</version>
</dependency>
-
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.7</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>nar-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>com.github.maven-nar</groupId>
+ <artifactId>nar-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <cpp>
+ <debug>true</debug>
+ </cpp>
+ <libraries>
+ <library>
+ <type>jni</type>
+ <narSystemPackage>com.zorroa.archivist.processors</narSystemPackage>
+ </library>
+ </libraries>
+ <javah>
+ <includes>
+ <include></include>
+ </includes>
+ </javah>
+ <tests>
+ <test>
+ <name>Caffe</name>
+ </test>
+ </tests>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>I have run javah via "mvn nar:nar-javah" successfully for the nar-maven-plugin it examples 0003, 0005, and 0007. Any debugging tips, workarounds are greatly appreciated.
--
You received this message because you are subscribed to the Google Groups "NAR Maven plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maven-nar+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.