运行时不存在 Maven 传递依赖项

标签 maven

我有一个使用 Maven 构建的 Netbeans RCP 项目,但在构建其中一个模块期间我的构建失败,并出现以下错误行:

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

你能建议可以做些什么吗?我尝试添加 org.netbeans.api:org-openide-util-lookup使用 dependencies > add但它无法完成(看起来依赖项已经存在)。

这是 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的新手。项目本身在构建之前看起来很好(没有错误)。

最佳答案

好的,我终于想通了。我将把分析器留在这里,也许它会在 future 帮助某人......

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

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



所以基本上,你必须手动添加与 org.netbeans.api 相关的所有依赖项到pom.xml然后它开始工作。引用的文章声称这种不一致可能在 Maven 3 中得到解决,但遗憾的是,事实并非如此。

关于运行时不存在 Maven 传递依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24930380/

相关文章:

java - createDatabaseIfNotExist=true 在 maven 项目的 .properties 文件中不起作用

java - 将依赖项与我的主 jar 并排复制

java - 任何可用于 LiquiBase 的 API

java - Spring Boot - 不支持的主要.次要版本 51.0

java - Maven/Gradle 列出已编译的类

java - 如何使用 maven-plugin-plugin 生成 Fat Maven 插件?

maven - Jenkins使用docker构建无法访问nexus的Maven镜像

java - 连接到 Google Cloud SQL com.google.cloud.sql.mysql.SocketFactory 转换时出错

java - 如何从pom.xml获取maven项目安装目录

java - 无法启动 Spring-Boot 示例