[ 
http://jira.codehaus.org/browse/MOJO-651?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Tran closed MOJO-651.
-------------------------

      Assignee: Dan Tran
    Resolution: Fixed

applied the patch, with a little modification to look for only jar artifact 
type.  I could not imagine where else the
user would ask this plugin to look for JNI classes.  I leave the exception 
handler alone, since it only happens when
the jar file is corrupted and we should not ignore it.

> dll-project having dependency to both jar (for javah) and lib (for linking) 
> not possible
> ----------------------------------------------------------------------------------------
>
>                 Key: MOJO-651
>                 URL: http://jira.codehaus.org/browse/MOJO-651
>             Project: Mojo
>          Issue Type: Bug
>          Components: native
>         Environment: maven 2.0.5, windows xp sp2, VS2005, 
> org.codehaus.mojo:native-maven-plugin:1.0-alpha-2
>            Reporter: Jan Palmquist
>         Assigned To: Dan Tran
>            Priority: Blocker
>         Attachments: NativeJavahMojo.patch
>
>
> Hello!
> I have a dll-project to produce a library to be loaded by a jar.
> The jar file is a dependency to the dll-project in order to run javah to 
> generate the jni header stubs.
> I do, however, also have a dependency to a lib-artifact as well in order to 
> being able to create the dll. The native-plugin tries to open that artifact 
> as if it was a zip-file, which obviously is not a good idea since it is not a 
> zip-file... :-)
> From what I have seen in the code, dependencies with scope provided and test 
> are filtered away 
> (http://mojo.codehaus.org/maven-native/native-maven-plugin/xref/org/codehaus/mojo/natives/plugin/NativeJavahMojo.html#177),
>  however all types of artifacts are accepted.
> An easy way to resolve this issue would be to silently ignore (or possibly 
> warn) the error if failing to open the (assumed to be) zip-file. If the set 
> of artifact types are well known (.lib, .so, .a, .o, etc), those types could 
> easily be filtered out in the getJavahArtifacts()-method as well (maybe this 
> should be the case anyway in order to avoid unneccessary warnings due to 
> zip-file problems)?
> Here's my stack trace:
> [INFO] Parsing C:\Documents and 
> Settings\<myusr>\.m2\repository\test\jni\jnitest\SNAPSHOT\jnitest-SNAPSHOT.lib
>  for native classes.
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Error searching for native class in dependencies
> Embedded error: error in opening zip file
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Error searching for 
> native class in dependencies
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Error searching 
> for native class in dependencies
>         at 
> org.codehaus.mojo.natives.plugin.NativeJavahMojo.getNativeClassNames(NativeJavahMojo.java:270)
>         at 
> org.codehaus.mojo.natives.plugin.NativeJavahMojo.createProviderConfiguration(NativeJavahMojo.java:286)
>         at 
> org.codehaus.mojo.natives.plugin.NativeJavahMojo.execute(NativeJavahMojo.java:131)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
>         ... 16 more
> Caused by: java.util.zip.ZipException: error in opening zip file
>         at java.util.zip.ZipFile.open(Native Method)
>         at java.util.zip.ZipFile.<init>(ZipFile.java:203)
>         at java.util.zip.ZipFile.<init>(ZipFile.java:234)
>         at 
> org.codehaus.mojo.natives.plugin.NativeJavahMojo.getNativeClassNames(NativeJavahMojo.java:240)
>         ... 20 more
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 4 seconds
> [INFO] Finished at: Sat Feb 17 20:51:13 CET 2007
> [INFO] Final Memory: 6M/12M
> [INFO] 
> ------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to