运行时不存在Maven传递依赖项 [英] Maven transitive dependencies not present during runtime

查看:86
本文介绍了运行时不存在Maven传递依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Maven构建的Netbeans RCP项目,但是在构建具有以下错误行的模块之一的过程中,构建失败:

I have a Netbeans RCP project built using Maven but my build fails during building of one of the modules with the following error line:

--- nbm-maven-plugin:3.13:manifest (default-manifest) @ FNApi ---
NBM Plugin generates manifest
Project uses classes from transitive module org.netbeans.api:org-openide-util:jar:RELEASE80 which will not be accessible at runtime.
    To fix the problem, add this module as direct dependency. For OSGi bundles that are supposed to be wrapped in NetBeans modules, use the useOSGiDependencies=false parameter
Project uses classes from transitive module org.netbeans.api:org-openide-util-lookup:jar:RELEASE80 which will not be accessible at runtime.
    To fix the problem, add this module as direct dependency. For OSGi bundles that are supposed to be wrapped in NetBeans modules, use the useOSGiDependencies=false parameter

您能否建议可以采取哪些措施?我尝试使用dependencies > add添加org.netbeans.api:org-openide-util-lookup,但无法完成(看起来已经存在依赖项了.)

Could you suggest what can be done about it? I tried adding the org.netbeans.api:org-openide-util-lookup using dependencies > add but it cannot be done (it looks like the dependency is already there).

这是Netbeans的完整堆栈跟踪:

This is the full stack trace fron Netbeans:

--- nbm-maven-plugin:3.13:manifest (default-manifest) @ FNApi ---
NBM Plugin generates manifest
Project uses classes from transitive module org.netbeans.api:org-openide-util:jar:RELEASE80 which will not be accessible at runtime.
    To fix the problem, add this module as direct dependency. For OSGi bundles that are supposed to be wrapped in NetBeans modules, use the useOSGiDependencies=false parameter
Project uses classes from transitive module org.netbeans.api:org-openide-util-lookup:jar:RELEASE80 which will not be accessible at runtime.
    To fix the problem, add this module as direct dependency. For OSGi bundles that are supposed to be wrapped in NetBeans modules, use the useOSGiDependencies=false parameter
------------------------------------------------------------------------
Reactor Summary:

FNSD-maven-parent ................................. SUCCESS [0.563s]
FNSD-maven-branding ............................... SUCCESS [1.695s]
FNSD-maven-app .................................... SUCCESS [14.645s]
WidgetAPI ......................................... SUCCESS [2.468s]
FNApi ............................................. FAILURE [1.304s]
Browser ........................................... SKIPPED
FlamingoIntegration ............................... SKIPPED
FNCore ............................................ SKIPPED
NetDesigner ....................................... SKIPPED
DST ............................................... SKIPPED
Production ........................................ SKIPPED
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 21.553s
Finished at: Thu Jul 24 11:33:20 CEST 2014
Final Memory: 20M/247M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:3.13:manifest (default-manifest) on project FNApi: See above for failures in runtime NetBeans dependencies verification. -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

感谢您的帮助.我是Maven的新手.在构建之前,项目本身看起来很好(没有错误).

Any help is appreciated. I am new to Maven. The project itself looks fine (no errors) before built.

推荐答案

好,我终于明白了.我将把分析器留在这里,也许它将在将来对某人有所帮助...

Ok, I finally figured it out. I will leave the anser here, perhaps it will help somebody in the future...

http://wiki.netbeans.org/Maven_NBM_comments :

maven编译依赖关系树与Maven编译依赖关系树之间存在不一致 运行时Netbeans依赖项.

There is inconsistence between maven compile dependency tree and the runtime netbeans dependencies.

因此,基本上,您必须将与org.netbeans.api相关的所有依赖项添加到pom.xml中,然后它才能开始工作.引用的文章声称这种矛盾可以在Maven 3中解决,但不幸的是,并非如此.

So basically, you have to manullay add all dependecies related to org.netbeans.api to the pom.xml and then it starts to work. The quoted article claimed that this inconsitency may be solved in Maven 3 but sadly, it is not.

这篇关于运行时不存在Maven传递依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆