Maven native plugin and JNI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • etiainen
    New Member
    • Aug 2007
    • 40

    #1

    Maven native plugin and JNI

    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:

    (the jni one in svn)

    The profile is win32 and MSVC is the compiler provider.

    I get the following error:
    Code:
    [ERROR] 
    
    Maven encountered an error while looking up the following Mojo:
    Group-Id: org.codehaus.mojo
    Artifact-Id: native-maven-plugin
    Version: 1.0-alpha-2
    Mojo: compile
    brought in via: Direct invocation
    
    Referenced from project:
    Group-Id: org.codehaus.mojo.natives.it.jni.win32
    Artifact-Id: hello
    Version: 1.0-SNAPSHOT
    From file: \\Sfil0\UserData$\pjovanovic05\workspace\jni\native\win32\pom.xml
    Reason: Unable to lookup component 'org.apache.maven.plugin.Mojo', it could not be started.
          role: org.apache.maven.plugin.Mojo
      roleHint: org.codehaus.mojo:native-maven-plugin:1.0-alpha-2:compile
    classRealm: /plugins/org.codehaus.mojo:native-maven-plugin:1.0-alpha-2@48/thread:main
    
    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]]]).
          role: org.codehaus.mojo.natives.manager.CompilerManager
      roleHint: default
    classRealm: /plugins/org.codehaus.mojo:native-maven-plugin:1.0-alpha-2@48/thread:main

    Anybody seen anything like this?
    Last edited by etiainen; Jun 4 '08, 08:04 AM. Reason: better title
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    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

    Comment

    • etiainen
      New Member
      • Aug 2007
      • 40

      #3
      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!

      Comment

      • etiainen
        New Member
        • Aug 2007
        • 40

        #4
        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 <compilerStartO ptions> and i gave up on IDEs, just did it from console...
        Also I've added user32.lib & advapi32.lib to linkerStartOpti on (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!

        Comment

        Working...