Ok, I added  javah -o support.

You will need to get the latest source and build it your self since I am not
able to deploy a snapshot to codehaus

native-maven-plugin/src/it/jni/native/win32/pom.xml has the example
configuration

-Dan


On 6/22/06, dan tran <[EMAIL PROTECTED]> wrote:

see comments inline

 On 6/22/06, TimHedger <[EMAIL PROTECTED]> wrote:
>
>
> Thank you for the feedback so far.  I've adopted the pom.xml changes you
> suggested.  I'd love to look at the Solaris jni example - how do I get
> it?
> (i.e. how do I check out the jni example on solaris under
> native-maven-plugin/src/it/jni?)


 https://svn.codehaus.org/mojo/trunk/mojo/maven-native/

that will get you all the source code + examples

The jni step runs, but I'm having problems with compilation because the
> jni
> output file has a different name to that in my existing build system
> (and I
> don't want to change the code, as then the old build system won't
> work).  My
> existing javah command line has a -o <filename> parameter that specifies
> the
> output filename (so I'm able to specify BcpBase.h instead of getting the
>
> fully qualified package based name under the native plugin
> rbos.fm.mktrisk.sql.BcpBase.h).  The web site configuration pages don't
> show
> any way of passing in the -o parameter to javah - can this be done?



 suggest to do an experimental port by creating a branch for it.  It is
quite tough
to keep the legacy file system intact.



This is my current pom.xml:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0 "
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd";>
> <modelVersion>4.0.0</modelVersion>
> <groupId>rbos.fm.mktrisk</groupId>
> <artifactId>javabcp</artifactId>
> <packaging>so</packaging>
> <version>1.0-SNAPSHOT</version>
> <name>Maven Quick Start Archetype</name>
> <url>http://maven.apache.org</url>
>    <dependencies>
>      <dependency>
>         <groupId>rbos.fm.mktrisk</groupId>
>         <artifactId>javabcpbase</artifactId>
>         <version>1.0-SNAPSHOT</version>
>         <scope>compile</scope>
>      </dependency>
>      <!--add other native libs to be linked in-->
>   </dependencies>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>native-maven-plugin</artifactId>
>         <extensions>true</extensions>
>         <configuration>
>
>
> <compilerExecutable>/opt/workshop5/SUNWspro/SC5.0/bin/cc</compilerExecutable>
>           <compilerStartOptions>
>             <compilerStartOption> -c -g -Dsun_svr4=1



 remove -c,   the plugin will insert it

-DSOLARIS</compilerStartOption>
>           </compilerStartOptions>
>           <sources>
>             <source>
>               <directory>src/main/c</directory>
>               <fileNames>
>                 <fileName>exutils.c</fileName>
>                 <fileName> Blk.c</fileName>
>               </fileNames>
>             </source>
>             <source>
>               <directory> /opt/sybaseSW/sybase12.5/OCS-12_0/include
> </directory>
>             </source>
>             <source>
>               <directory> /usr/java1.4.1_02_32/include </directory>
>             </source>

            <source>
>               <directory> /usr/java1.4.1_02_32/include/solaris
> </directory>
>             </source>
>           </sources>




 suggest to set <jdkIncludePath>/usr/java1.4.1_02_32</jdkIncludePath>
>

so you dont have to set previous 2 include paths

          <linkerStartOptions>
>             <linkerStartOption> -G -lblk -lct -lcs -ltcl -lcomn -lintl
> -Bdynamic -lnsl -ldl -lm </linkerStartOption>
>           </linkerStartOptions>
>         </configuration>
>
>         <!-- Generate JNI header files based on a list of class name on
> the
> classpath -->
>         <!-- The generated include directory is automatically added to
> include path at compile phase -->
>         <!-- Ensure to have appropriate denpendency jar file(s) in your
> pom
> -->
>
>         <executions>
>           <execution>
>             <id>javah</id>
>             <phase>generate-sources</phase>
>             <configuration>
>               <classNames>
>                 <!--className> rbos.fm.mktrisk.sql.BcpBase</className-->
>               </classNames>
>               <!--
>                |   Note:
>                |    1. Without classNames, javah mojo will search for
> all
> JNI classes
>                |       in your dependency list.
>               -->
>             </configuration>
>             <goals>
>               <goal>javah</goal>
>             </goals>
>           </execution>
>        </executions>
>      </plugin>
>    </plugins>
> </build>
> </project>
>
> And this is the javah command line from my existing build system:
> /usr/java1.4.1_02_32/bin/javah -jni -classpath (classpath list)  -o
> /home/hedgert/work/javautil/gen/rbos/fm/mktrisk/sql/BcpBase.h
> rbos.fm.mktrisk.sql.BcpBase




 you will need to file a JIRA for this request.  better yet help to patch
it

And this is what I'm getting under Maven:
> /usr/java1.4.1_02_32/jre/../bin/javah -d
> /home/hedgert/maven/javabcp/target/native/javah -classpath
>
> 
/home/hedgert/.m2/repository/rbos/fm/mktrisk/javabcpbase/1.0-SNAPSHOT/javabcpbase-
> 1.0-SNAPSHOT.jar
> rbos.fm.mktrisk.sql.BcpBase




--
> View this message in context:
> 
http://www.nabble.com/Can%27t-get-jni-working-based-on-example-configuration-t1825144.html#a5006238
> Sent from the Maven - Users forum at Nabble.com <http://nabble.com/>.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Reply via email to