mvn 报错 - The POM for is invalid, transitive dependencies (if any) will not be available

核心:  通过 mvn dependency:tree -X 分析依赖
解决方案:  解决依赖冲突版本

1. MILGpController 编译突然报错

14:10:28 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project MILCWSGpPortlet: Compilation failure: Compilation failure:
14:10:28 [ERROR] /app/jenkins/workspace/HK-CWS/sit/HK_CWS_DV11/work/workspace/CWSWS_WPS8/MILCWSGpPortlet/src/manulife/hk/cws/portlet/empf/controller/MILGpController.java:[33,38] package manulife.common.framework.http does not exist
14:10:28 [ERROR] /app/jenkins/workspace/HK-CWS/sit/HK_CWS_DV11/work/workspace/CWSWS_WPS8/MILCWSGpPortlet/src/manulife/hk/cws/portlet/empf/controller/MILGpController.java:[163,9] cannot find symbol
14:10:28 [ERROR] symbol: class SessionStoreModel
14:10:28 [ERROR] location: class manulife.hk.cws.portlet.empf.controller.MILGpController
14:10:28 [ERROR] /app/jenkins/workspace/HK-CWS/sit/HK_CWS_DV11/work/workspace/CWSWS_WPS8/MILCWSGpPortlet/src/manulife/hk/cws/portlet/empf/controller/MILGpController.java:[163,47] cannot find symbol
14:10:28 [ERROR] symbol: variable SessionStoreModel
14:10:28 [ERROR] location: class manulife.hk.cws.portlet.empf.controller.MILGpController
14:10:28 [ERROR] -> [Help 1]
14:10:28 [ERROR]
14:10:28 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
14:10:28 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
14:10:28 [ERROR]
14:10:28 [ERROR] For more information about the errors and possible solutions, please read the following articles:
14:10:28 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
14:10:28 [ERROR]
14:10:28 [ERROR] After correcting the problems, you can resume the build with the command
14:10:28 [ERROR] mvn <goals> -rf :MILCWSGpPortlet


2.发现一个可疑 WARN:

Downloaded: https://artifactory.ap.manulife.com/artifactory/libs-release/manulife/MILSessionManager/1.0.4-jdk8/MILSessionManager-1.0.4-jdk8.pom (2 KB at 69.3 KB/sec)
11:12:16 [WARNING] The POM for manulife:MILSessionManager:jar:1.0.4-jdk8 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more


3.找寻该依赖

POM.xml 里面没有 MILSessionManager:jar:1.0.4-jdk8 的依赖,应该是间接依赖


4. 分析依赖

通过 mvn dependency:tree -X 分析依赖,发现来自于 MILPortletFramework

5. 发现问题

查看 MILPortletFramework 的依赖,发现依赖于 MILSessionManager:jar:1.0.4-jdk8 版本不一致

        <dependency>
            <groupId>manulife</groupId>
            <artifactId>MILSessionManager</artifactId>
            <version>1.0.1</version>
        </dependency>

再加上查看 WARN,分析是依赖冲突,

 

6. 解决问题

在 MILGpController 加上依赖后,编译问题解决

        <dependency>
            <groupId>manulife</groupId>
            <artifactId>MILSessionManager</artifactId>
            <version>1.0.4-jdk8</version>
        </dependency>

搜寻到的更多猜测:

原因之一是当依赖父 pom 已过时的 Project 时。 如果在未安装/部署父 pom 的情况下进行更新,则会发生这种情况。要查看是否是这种情况,只需使用 mvndependency:tree -X 运行并搜索确切的错误。
它将提到它错过了您知道的在父pom中的东西,而不是您依赖的工件(例如jar版本)中的东西。
另外,由于 WARN 造成了 jar 被 transitive,也是触发这个的原因。

上一篇:python 2/3重定向输出文件


下一篇:phpexcel 网页可能暂时无法连接,或者它已永久性地移动到了新网址 ERR_INVALID_RESPONSE