无法解决 Maven 系统范围依赖关系

maven system scope dependency could not be resolved

我有一个在 IBM 上 运行 的应用程序。它是一个 Maven 项目,在它的依赖树上有一些是 运行time 依赖,但它们的范围是系统。

这些系统范围 jar 不存在于 .m2/repository 或我们的本地 nexus 中。但是我可以在我的本地环境中编译项目(mvn clean install)。一些如何,maven 可以找到这些罐子。

[INFO] |  |  +- com.ibm.was:was-server-runtime-lib:pom:7.0.0:provided
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.wccm:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.emf:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:j2ee:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:mail-impl:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.runtime:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.ejbportable:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.admin.core:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.admin.services:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.portletcontainer:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:bootstrap:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.sib.server:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.sip.container:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.sip.interface:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.webcontainer:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:marshall:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:ffdcSupport:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:wsatlib:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.runtime.dist:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.mq:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.mq.headers:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.mq.pcf:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.mq.jmqi:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.mq.connector:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.mq.commonservices:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:dhbcore:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:org.eclipse.emf.common:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:org.eclipse.emf.commonj.sdo:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:org.eclipse.emf.ecore.change:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:org.eclipse.emf.ecore.sdo:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:org.eclipse.emf.ecore.xmi:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:org.eclipse.emf.ecore:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.prereq.wsdl4j:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.jaxb.tools:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.jaxws.tools:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.wsfp.main:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.prereq.vajava:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:rsadbutils:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.jpa:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.prereq.commonj-twm:jar:7.0.0:system
[INFO] |  |  |  +- com.ibm.websphere.application.server.v7.0:com.ibm.ws.prereq.soap:jar:7.0.0:system
[INFO] |  |  |  \- com.ibm.websphere.application.server.v7.0:com.ibm.mqjms:jar:7.0.0:system

但是,在构建服务器上找不到这些 jar 并出现以下错误。

The following artifacts could not be resolved: com.ibm.websphere.application.server.v7.0:com.ibm.ws.wccm:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.emf:jar:7.0.0, com.ibm.websphere.application.server.v7.0:j2ee:jar:7.0.0, com.ibm.websphere.application.server.v7.0:mail-impl:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.runtime:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.ejbportable:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.admin.core:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.admin.services:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.portletcontainer:jar:7.0.0, com.ibm.websphere.application.server.v7.0:bootstrap:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.sib.server:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.sip.container:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.sip.interface:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.webcontainer:jar:7.0.0, com.ibm.websphere.application.server.v7.0:marshall:jar:7.0.0, com.ibm.websphere.application.server.v7.0:ffdcSupport:jar:7.0.0, com.ibm.websphere.application.server.v7.0:wsatlib:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.runtime.dist:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.mq:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.mq.headers:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.mq.pcf:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.mq.jmqi:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.mq.connector:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.mq.commonservices:jar:7.0.0, com.ibm.websphere.application.server.v7.0:dhbcore:jar:7.0.0, com.ibm.websphere.application.server.v7.0:org.eclipse.emf.common:jar:7.0.0, com.ibm.websphere.application.server.v7.0:org.eclipse.emf.commonj.sdo:jar:7.0.0, com.ibm.websphere.application.server.v7.0:org.eclipse.emf.ecore.change:jar:7.0.0, com.ibm.websphere.application.server.v7.0:org.eclipse.emf.ecore.sdo:jar:7.0.0, com.ibm.websphere.application.server.v7.0:org.eclipse.emf.ecore.xmi:jar:7.0.0, com.ibm.websphere.application.server.v7.0:org.eclipse.emf.ecore:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.prereq.wsdl4j:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.jaxb.tools:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.jaxws.tools:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.wsfp.main:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.prereq.vajava:jar:7.0.0, com.ibm.websphere.application.server.v7.0:rsadbutils:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.jpa:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.prereq.commonj-twm:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.ws.prereq.soap:jar:7.0.0, com.ibm.websphere.application.server.v7.0:com.ibm.mqjms:jar:7.0.0: Could not find artifact com.ibm.websphere.application.server.v7.0:com.ibm.ws.wccm:jar:7.0.0 at specified path C:\..\com.ibm.ws.wccm.jar -> [Help 1]

系统范围的依赖项不是从 Nexus 存储库下载的。它们应该存在于 pom 文件中指定的系统中。我已经意识到 pom 文件中有一些系统路径,并且 releted jar 应该存在于这个文件夹中。为了解决这个问题,我在完全相同的位置创建了一个文件夹,并将所有相关的 jar 文件复制到这个文件夹中。之后,我能够编译该项目。

系统范围依赖性的示例 pom 文件内容,对于此示例,应将缺少的 jars 复制到 c:\SharedSystemLib。就这些了。

<dependency>
    <groupId>${groupId}</groupId>
    <artifactId>com.ibm.ws.wccm</artifactId>
    <version>${version}</version>
    <scope>system</scope>
    <systemPath>c:\SharedSystemLib</systemPath>
</dependency>