一个大的maven 项目,结构是一个根pom,下面几个小的module,包括了appservice-darc,appservice-entity等,其中appservice-darc 依赖了 appservice-entity。

但是呢,对根项目的pom, 执行mvn clean complie 是没问题的,但是对 appservice-darc  执行 mvn clean complie是不行的,出现下面错误:

[INFO] ------------------------------------------------------------------------
[INFO] Building appservice-darc 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.worepay:appservice-entity:jar:0.0.1-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for
more details
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ appservice- ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ appservice- ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 10 source files to F:\dev\SVN\GYF\newAppservice\appservice-\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /F:/dev/SVN/GYF/newAppservice/src/main/java/com/worepay/appservice//Banner.java:[3,25] 程序包javax.persistence不存在
[ERROR] /F:/dev/SVN/GYF/newAppservice/src/main/java/com/worepay/appservice//Banner.java:[4,25] 程序包javax.persistence不存在
[ERROR] /F:/dev/SVN/GYF/newAppservice/src/main/java/com/worepay/appservice//Banner.java:[5,25] 程序包javax.persistence不存在
[ERROR] /F:/dev/SVN/GYF/newAppservice/src/main/java/com/worepay/appservice//Banner.java:[8,2] 找不到符号
符号: 类 Table
[ERROR] /F:/dev/SVN/GYF/newAppservice/src/main/java/com/worepay/appservice//Banner.java:[12,10] 找不到符号
符号: 类 Id
位置: 类 com.worepay.appservice..Banner
[ERROR] /F:/dev/SVN/GYF/newAppservice/src/main/java/com/worepay/appservice//Banner.java:[13,10] 找不到符号
符号: 类 Column
位置: 类 com.worepay.appservice..Banner
[ERROR] /F:/dev/SVN/GYF/newAppservice/src/main/java/com/worepay/appservice//Banner.java:[17,10] 找不到符号
符号: 类 Column

IDEA中项目源码中是没有错误的,说明编译是ok的,但是执行maven compile 就是不行。。  检查发现 persistence-api-1.0.jar 依赖也确实是存在的。但是为什么mvn操作就总是不行呢?

appservice-darc 依赖了 appservice-entity,而从上面的日志看, appservice-entity好像有什么问题。。 pom 为什么是 invalid ? 打开pom 是没用任何错误提示的呢, 那就奇怪了。。

后面通过maven 调试发现(添加 -X 参数 ),发现appservice-entity确实还是有问题的。原因是appservice-entity 的pom 引用了一个本地的jar,它的写法是 相对路径,从而导致appservice-entity 所依赖的所有jar都不可用了,如下:

        <dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc14_g.jar</systemPath>
</dependency>

从而,maven compile 失败了。 怎么解决呢? 提示告诉我,需要写成绝对路径的形式。 把那个本地jar 的地址改为绝对路径就好了:

        <dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1.0</version>
<scope>system</scope>
<systemPath>F:/dev/SVN/GYF/rxw/newAppservice/appservice-entity/lib/ojdbc14_g.jar</systemPath>
</dependency>

不过,发现 还行需要先把appservice-entity 先install,不install 还不行。我开始就是compile了一下,以为都在一个项目了, 应该不至于那么傻,引用不到吧。结果还真是,还是报之前一样的错误。后面只有乖乖的install 一下,结果就好了。

观察发现,appservice-darc 是从本地maven 仓库中去获取appservice-entity 的jar , 因为单单是maven compile,不能要保证本地仓库中的appservice-entity 已经是最新的,是没用的。如果事先对appservice-entity执行clean compile,那么clean 操作会清除本地仓库对应的 jar, 所以本地仓库中的appservice-entity 是不存在的,仅仅存在于当前项目的target目录。

Maven 错误 :The POM for com.xxx:jar:0.0.1-SNAPSHOT is invalid, transitive dependencies (if any) will not be available的更多相关文章

  1. maven编译问题之 -The POM for XXX is invalid, transitive dependencies (if any) will not be available

    问题一: 把父工程tao-parent install 到maven本地仓后,接着install tao-common工程,然后报错 报错信息如下: [WARNING] The POM for com ...

  2. The POM for XXX is invalid, transitive dependencies (if any) will not be available解决方案

    今天,某个开发的环境在编译的时候提示警告The POM for XXX is invalid, transitive dependencies (if any) will not be availab ...

  3. The POM for com.alibaba:druid:jar:1.2.6 is invalid, transitive dependencies (if any) will not be available

    开发环境 IDEA2020.3,  jdk1.8.0_231 问题描述 开发中引入了druid-spring-boot-starter最新版本1.2.6,项目install时的时候一直出现警告 The ...

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

    核心:  通过 mvn dependency:tree -X 分析依赖解决方案:  解决依赖冲突版本 1. MILGpController 编译突然报错 14:10:28 [ERROR] Failed ...

  5. Maven错误-Missing artifact com.sun:tools:jar:1.5.0:system 解决方式

    1.Missing artifact com.sun:tools:jar:1.5.0:system Could not resolve dependencies for project com.ifl ...

  6. 针对Eclipse的maven Missing artifact com.microsoft.sqlserver:slqjdbc4:jar:4.0

    maven 中添加sqlserver 出错,报错内容 maven Missing artifact com.microsoft.sqlserver 解决方法这里先下载好jar包 ,然后maven命令执 ...

  7. 解决eclipse中maven出现的Failure to transfer XXX.jar的问题

    这个问题很烦,试了好几次都没有彻底解决,今天终于找到解决办法了. 问题主要出在,maven在下载jar的过程中出现了中断或者错误问题(不仅仅是eclipse,其他IDE也一样) 解决办法: 移除之前的 ...

  8. Maven Assembly打包提示[WARNING] transitive dependencies if any will not be available

    maven assembly打包出现错误 [WARNING] The POM for com.flink.xxr:0.0.1-SNAPSHOT is invalid, transitive depen ...

  9. 修改和编译spring源码,构建jar(spring-context-4.0.2.RELEASE)

    上周在定位问题时,发现Spring容器实例化Bean的时候抛出异常,为了查看更详细的信息,决定修改spring-context-4.0.2.RELEASE.jar中的CommonAnnotationB ...

随机推荐

  1. uWSGI+Django+nginx(下)

    在上篇文章 说的uWSGI和Django都已没问题的情况下 找到 nginx的配置文件 我的是:/etc/nginx/nginx.conf 修改这个文件 在http{}里加入 下面的 server { ...

  2. python-算法基础

    1.时间复杂度和空间复杂度 2.查找算法 2.1 二分查询法 2.1.1 非递归代码 def erfen(data,target): low = 0 high = len(data) - 1 whil ...

  3. cordova本地浮动框提示插件使用:cordova-plugin-x-toast

    1. 添加插件:cordova plugin add cordova-plugin-x-toast 2. 调用方法(浮动提示插件,弹出本地浮动提示框): $cordovaToast.show(mess ...

  4. sql注入-推断是否存在SQL注入-and大法和or大法

    来自:https://www.cnblogs.com/ichunqiu/p/5749347.html 页面不返回任何错误信息,我们就可以借助本方法来推断了,首先我们在参数后面加上 and 1=1和an ...

  5. 18.13 Uboot分析与移植

    18.13.1 使用JLink烧写Nor Flash JLink只支持烧写NOR Flash,不支持烧写Nand Flash. 1.准备工作:JLink的USB口接到电脑上,JLink的JTAG口用排 ...

  6. ASP.NET: Cookie会话丢失,Session超时配置

    问题描述: asp.net应用中web.config的SessionState节点:原先是 <sessionState mode="InProc" timeout=" ...

  7. 微信小程序托管 推广 开发 就找北京动点软件

    微信小程序托管 外包 微信小程序外包 H5外包 就找北京动点软件 长年承接微信小程序.微信公众号开发 全职的H5开发团队,开发过几十款微信小程序公众号案例 欢迎来电咨询,索取案例! QQ:372900 ...

  8. C# .NET newtonsoft.json 多版本冲突解决

    A.DLL 引用了6.0 的 newtonsoft.json  (V2 运行时),B.DLL 引用了10.0 的 newtonsoft.json (V4 运行时). 可以在.CONFIG RUNTIM ...

  9. qt5程序打包含qml

    Qt 官方开发环境使用的动态链接库方式,在发布生成的exe程序时,需要复制一大堆 dll,如果自己去复制dll,很可能丢三落四,导致exe在别的电脑里无法正常运行. 因此 Qt 官方开发环境里自带了一 ...

  10. 转 Ubuntu16.04+QT4.8.7开发环境搭建

    Qt安装步骤1.安装g++以及依赖库 sudo apt-get install g++  sudo apt-get install g++-multilib libx11-dev libxext-de ...