Maven NetBeans Module Plugin

Dependency verification failure - More descriptive error logging

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 3.2
  • Fix Version/s: 3.2
  • Component/s: None
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    1

Description

Plugin should print out more descriptive information, when there is a problem in dependencies. In simple attached example, I got error without any information, what happened:

[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 2 source files to P:\test\nbm-plugin-error\module1\target\class
es
[INFO] [nbm:manifest {execution: default-manifest}]
[INFO] NBM Plugin generates manifest
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] See above for failures in runtime NebBeans dependencies verification.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds

And with -e switch:

[INFO] Trace
org.apache.maven.BuildFailureException: See above for failures in runtime NebBeans dependencies verification.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:699)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41)
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:597)
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.MojoFailureException: See above for failuresin runtime NebBeans dependencies verification.
at org.codehaus.mojo.nbm.NetbeansManifestUpdateMojo.checkModuleClassPath(NetbeansManifestUpdateMojo.java:585)
at org.codehaus.mojo.nbm.NetbeansManifestUpdateMojo.execute(NetbeansManifestUpdateMojo.java:432)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
... 17 more
[INFO] ------------------------------------------------------------------------

It happened in case, when there are more dependencies, not listed, but are not from transitional module or are not private.

See lines NetbeansManifestUpdateMojo.java:552 - 587.

Simple testcase attached.

Activity

Hide
Milos Kleint added a comment -

this is indeed a complex problem.

1. class StrBuilder is used in the module1 codebase
2. StrBuilder is not explicitly imported, but is a result type of a method call, from module util.
3. the module util is transitive and as such should be reported and made direct dependency by the user.
4. but it's not reported because the commons-lang dependency is duplicated as direct dependency in module1. If we comment out that dependency, we will get the proper error.
5. the commons-lang dependency in actually an OSGI bundle and is therefore not currently recognized as module's library, but as module dependency.

I'm wondering we we would get a proper error if the jar were not an OSGi bundle. This is actually the scenario I feared when adding Osgi dependency support. What if someone wants to add a bundle dep as plain library jar? Can we actually differentiate these 2 cases?

Show
Milos Kleint added a comment - this is indeed a complex problem. 1. class StrBuilder is used in the module1 codebase 2. StrBuilder is not explicitly imported, but is a result type of a method call, from module util. 3. the module util is transitive and as such should be reported and made direct dependency by the user. 4. but it's not reported because the commons-lang dependency is duplicated as direct dependency in module1. If we comment out that dependency, we will get the proper error. 5. the commons-lang dependency in actually an OSGI bundle and is therefore not currently recognized as module's library, but as module dependency. I'm wondering we we would get a proper error if the jar were not an OSGi bundle. This is actually the scenario I feared when adding Osgi dependency support. What if someone wants to add a bundle dep as plain library jar? Can we actually differentiate these 2 cases?
Hide
Pavel Jisl added a comment -

I found this problem, when I tried to compile our complex application with nbm-maven-plugin 3.2-SNAPSHOT. I was surprised, that I got this error message. With 3.1 version it was fine without problems.

Failed dependencies was spring, commons-lang, commons-io and maybe some others, hopefully all the osgi bundles. When I was looking into code, I found difference between 3.1 and 3.2-SNAPSHOT codebase and the commit was called "prepare infra for osgi bundle recognition." and one more with "osgi" string.

I tried to prepare testcase for this error, but had difficulties with it.

Show
Pavel Jisl added a comment - I found this problem, when I tried to compile our complex application with nbm-maven-plugin 3.2-SNAPSHOT. I was surprised, that I got this error message. With 3.1 version it was fine without problems. Failed dependencies was spring, commons-lang, commons-io and maybe some others, hopefully all the osgi bundles. When I was looking into code, I found difference between 3.1 and 3.2-SNAPSHOT codebase and the commit was called "prepare infra for osgi bundle recognition." and one more with "osgi" string. I tried to prepare testcase for this error, but had difficulties with it.
Hide
Milos Kleint added a comment -

http://fisheye.codehaus.org/changelog/mojo/?cs=11849

now most osgi related work is hidden behind a new switch on the manifest updating mojo. any previous usage shall therefore behave as expected.

Show
Milos Kleint added a comment - http://fisheye.codehaus.org/changelog/mojo/?cs=11849 now most osgi related work is hidden behind a new switch on the manifest updating mojo. any previous usage shall therefore behave as expected.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: