springboot [WARNING] 'dependencies.dependency.systemPath' for
阿新 • • 發佈:2022-05-05
- 描述
使用Maven打包時,總是會出現警告,原因是我引用了本地lib包導致。
D:\workspace\f>mvn package
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.hgc:f2_maven:war:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for org.jbarcode:jbarcode-0.2.8:jar should not point at files within the project di
rectory, ${basedir}/web/WEB-INF/lib/jbarcode-0.2.8.jar will be unresolvable by dependent projects @ line 886, column 16
[WARNING] 'dependencies.dependency.systemPath' for com.hgc.provisioning:ProvisioningClient:jar should not point at files within th
e project directory, ${basedir}/web/WEB-INF/lib/ProvisioningClient.jar will be unresolvable by dependent projects @ line 893, colu
mn 16
[WARNING] 'dependencies.dependency.systemPath' for org.objectweb.rmijdbc:RmiJdbc:jar should not point at files within the project
directory, ${basedir}/web/WEB-INF/lib/RmiJdbc.jar will be unresolvable by dependent projects @ line 900, column 16
[WARNING] 'dependencies.dependency.systemPath' for com.lowagie:itextasian:jar should not point at files within the project directo
ry, ${basedir}/${lib.dir}/itextasian-1.0.jar will be unresolvable by dependent projects @ line 907, column 16
[WARNING]
-
分析
systemPath被設計用來講一些系統庫包含進來,它們往往具有固定的路徑。當在自己的project中使用這個特性但是指定相對路徑如${basedir}/src/lib之類的,就會提示這個。通過網路搜尋,發現解決的方案還是有的。 -
解決方法
方式一、將basedir修改為pom.basedir
推薦使用方式一,簡單方便程式碼不多。
<dependency>
<groupId>org.jbarcode</groupId>
<artifactId>jbarcode-0.2.8</artifactId>
<version>0.2.8</version>
<scope>system</scope>
<systemPath>${pom.basedir}/web/WEB-INF/lib/jbarcode-0.2.8.jar</systemPath>
</dependency>
方式二、安裝到倉庫中
如下所示:
<dependency>
<groupId>org.jbarcode</groupId>
<artifactId>jbarcode</artifactId>
<version>0.2.8</version>
</dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>install-external</id>
<phase>clean</phase>
<configuration>
<file>${basedir}/web/WEB-INF/lib/jbarcode-0.2.8.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>org.jbarcode</groupId>
<artifactId>jbarcode</artifactId>
<version>0.2.8</version>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
轉自:https://www.jianshu.com/p/6c69e6b1b4f4