Connecting Tech Pros Worldwide Forums | Help | Site Map

Maven native plugin and JNI

etiainen's Avatar
Member
 
Join Date: Aug 2007
Posts: 40
#1: Jun 4 '08
Hi everyone!
I'm in a bit of a problem here:
I have to make a maven project for native (jni & C) code.

I am using this plugin: http://mojo.codehaus.org/maven-nativ...gin/index.html

and trying to make this example build:
http://mojo.codehaus.org/maven-nativ...s/jni-dll.html
(the jni one in svn)

The profile is win32 and MSVC is the compiler provider.

I get the following error:
Expand|Select|Wrap|Line Numbers
  1. [ERROR] 
  2.  
  3. Maven encountered an error while looking up the following Mojo:
  4. Group-Id: org.codehaus.mojo
  5. Artifact-Id: native-maven-plugin
  6. Version: 1.0-alpha-2
  7. Mojo: compile
  8. brought in via: Direct invocation
  9.  
  10. Referenced from project:
  11. Group-Id: org.codehaus.mojo.natives.it.jni.win32
  12. Artifact-Id: hello
  13. Version: 1.0-SNAPSHOT
  14. From file: \\Sfil0\UserData$\pjovanovic05\workspace\jni\native\win32\pom.xml
  15. Reason: Unable to lookup component 'org.apache.maven.plugin.Mojo', it could not be started.
  16.       role: org.apache.maven.plugin.Mojo
  17.   roleHint: org.codehaus.mojo:native-maven-plugin:1.0-alpha-2:compile
  18. classRealm: /plugins/org.codehaus.mojo:native-maven-plugin:1.0-alpha-2@48/thread:main
  19.  
  20. Root cause: Component descriptor cannot be found in the component repository: org.codehaus.mojo.natives.manager.CompilerManager [default] (lookup realm: ClassRealm[/plugins/org.codehaus.mojo:native-maven-plugin:1.0-alpha-2@48/thread:main, parent: ClassRealm[/projects/org.codehaus.mojo.natives.it.jni.win32:hello:1.0-SNAPSHOT/thread:main, parent: ClassRealm[plexus.core, parent: null]]]).
  21.       role: org.codehaus.mojo.natives.manager.CompilerManager
  22.   roleHint: default
  23. classRealm: /plugins/org.codehaus.mojo:native-maven-plugin:1.0-alpha-2@48/thread:main
  24.  

Anybody seen anything like this?

JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Jun 4 '08

re: Maven native plugin and JNI


Not knowing Maven the error diagnostic indicates to me that you haven't properly
installed Maven or forgot to set some (class)path variable for it. Check its
installation instructions. The error diagnostic indicates that it can't find one of its
own components.

kind regards,

Jos
etiainen's Avatar
Member
 
Join Date: Aug 2007
Posts: 40
#3: Jun 4 '08

re: Maven native plugin and JNI


Yeah, it does look like that, but it's a plugin and maven is pretty much just a bunch of plugins doing stuff.
The installation of the plugin is automated and instructed by POM, and i've literally copied the example from the repository and it breaks there.
I'am trying stuff, but it just wont click.

Thanks anyway!
etiainen's Avatar
Member
 
Join Date: Aug 2007
Posts: 40
#4: Jun 5 '08

re: Maven native plugin and JNI


Ok, so just in case anybody comes across this looking for an answer, I did it, and this is how:

in win32 pom, i've added -LD to <compilerStartOptions> and i gave up on IDEs, just did it from console...
Also I've added user32.lib & advapi32.lib to linkerStartOption (like in the tutorial)
There may have been more changes on my part, but I can't remember all now, and I think these were the key ones.
At first it didn't go, but when I logged on a few hours later it worked without any change. Oh the joy!
Reply