[WARNING] 'dependencies.dependency.systemPath' for

使用Maven打包时,总是会出现下面的 WARNING

[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.demo.abc:common:jar:1.1.0
[WARNING] 'dependencies.dependency.systemPath' for com.abc.toolbox:jar should not point at files within the project directory, ${basedir}/../lib/com.abc.toolbox-4.5.1.jar will be unresolvable by dependent projects @ line 21, column 25
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]

产生的原因:

  引用了本地jar包导致

pom.xml

<dependency>
     <groupId>com.abc</groupId>
     <artifactId>toolbox</artifactId>
     <version>4.5.1</version>
     <scope>system</scope>
     <systemPath>${basedir}/../lib/com.abc.toolbox-4.5.1.jar</systemPath>
</dependency>

解决方法:

  将 basedir 修改为 pom.basedir

<dependency>
     <groupId>com.abc</groupId>
     <artifactId>toolbox</artifactId>
     <version>4.5.1</version>
     <scope>system</scope>
     <systemPath>${pom.basedir}/../lib/com.abc.toolbox-4.5.1.jar</systemPath>
</dependency>

 

posted @ 2020-09-08 11:37  慕尘  阅读(11005)  评论(0编辑  收藏  举报