[WARNING] 'dependencies.dependency.systemPath' for...

╰半橙微兮° 2023-07-23 14:56 122阅读 0赞

1. 描述

使用Maven打包时,总是会出现警告,原因是我引用了本地lib包导致。

  1. D:\workspace\f>mvn package
  2. [INFO] Scanning for projects...
  3. [WARNING]
  4. [WARNING] Some problems were encountered while building the effective model for com.hgc:f2_maven:war:0.0.1-SNAPSHOT
  5. [WARNING] 'dependencies.dependency.systemPath' for org.jbarcode:jbarcode-0.2.8:jar should not point at files within the project di
  6. rectory, ${basedir}/web/WEB-INF/lib/jbarcode-0.2.8.jar will be unresolvable by dependent projects @ line 886, column 16
  7. [WARNING] 'dependencies.dependency.systemPath' for com.hgc.provisioning:ProvisioningClient:jar should not point at files within th
  8. e project directory, ${basedir}/web/WEB-INF/lib/ProvisioningClient.jar will be unresolvable by dependent projects @ line 893, colu
  9. mn 16
  10. [WARNING] 'dependencies.dependency.systemPath' for org.objectweb.rmijdbc:RmiJdbc:jar should not point at files within the project
  11. directory, ${basedir}/web/WEB-INF/lib/RmiJdbc.jar will be unresolvable by dependent projects @ line 900, column 16
  12. [WARNING] 'dependencies.dependency.systemPath' for com.lowagie:itextasian:jar should not point at files within the project directo
  13. ry, ${basedir}/${lib.dir}/itextasian-1.0.jar will be unresolvable by dependent projects @ line 907, column 16
  14. [WARNING]
  15. <dependency>
  16. <groupId>org.jbarcode</groupId>
  17. <artifactId>jbarcode-0.2.8</artifactId>
  18. <version>0.2.8</version>
  19. <scope>system</scope>
  20. <systemPath>${pom.basedir}/web/WEB-INF/lib/jbarcode-0.2.8.jar</systemPath>
  21. </dependency>
  1. 分析
    systemPath被设计用来讲一些系统库包含进来,它们往往具有固定的路径。当在自己的project中使用这个特性但是指定相对路径如${basedir}/src/lib之类的,就会提示这个。通过网络搜索,发现解决的方案还是有的。

  2. 解决方法
    方式一、将basedir修改为pom.basedir
    推荐使用方式一,简单方便代码不多。

  1. <dependency>
  2. <groupId>org.jbarcode</groupId>
  3. <artifactId>jbarcode-0.2.8</artifactId>
  4. <version>0.2.8</version>
  5. <scope>system</scope>
  6. <systemPath>${pom.basedir}/web/WEB-INF/lib/jbarcode-0.2.8.jar</systemPath>
  7. </dependency>

更改后,警告消失:

  1. D:\workspace\f>mvn package
  2. [INFO] Scanning for projects...
  3. [INFO]
  4. [INFO] ------------------------------------------------------------------------
  5. [INFO] Building f2_maven 0.0.1-SNAPSHOT
  6. [INFO] ------------------------------------------------------------------------
  7. [INFO]
  8. [INFO] --- maven-svn-revision-number-plugin:1.7:revision (default) @ f2_maven ---
  9. [INFO] inspecting D:\workspace\f
  10. [INFO] prefix = prefix
  11. [INFO] depth = empty
  12. [INFO] report unversioned = true
  13. [INFO] report ignored = false
  14. [INFO] report out-of-date = false
  15. [INFO] collecting status information
  16. [INFO] 7213 7213 D:\workspace\f
  17. [INFO] setting properties
  18. [INFO] prefix.repository =
  19. [INFO] prefix.path =
  20. [INFO] prefix.revision = 7213
  21. [INFO] prefix.mixedRevisions = false
  22. [INFO] prefix.committedRevision = 7213
  23. [INFO] prefix.committedDate = 2019-03-19 18:00:51 +0800 (Tue, 19 Mar 2019)
  24. [INFO] prefix.status =
  25. [INFO] prefix.specialStatus =
  26. [INFO]
  27. [INFO] --- maven-clean-plugin:2.3:clean (auto-clean) @ f2_maven ---
  28. [INFO] Deleting file set: D:\workspace\f\target (included: [**], excluded: [])
  29. [INFO]
  30. [INFO] --- build-helper-maven-plugin:1.8:add-resource (add-resource) @ f2_maven ---
  31. [INFO]
  32. [INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ f2_maven ---
  33. [INFO] Source directory: D:\workspace\f\src\base\java added.
  34. [INFO] Source directory: D:\workspace\f\src\pcfault\java added.
  35. [INFO]
  36. [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ f2_maven ---
  37. [INFO] Using 'UTF-8' encoding to copy filtered resources.
  38. [INFO] Copying 1 resource
  39. [INFO] Copying 6 resources
  40. [INFO] Copying 1 resource
  41. [INFO] Copying 8 resources
  42. [INFO] Copying 10 resources
  43. [INFO] Copying 7 resources
  44. [INFO] Copying 3 resources
  45. [INFO]
  46. [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ f2_maven ---
  47. [INFO] Compiling 3467 source files to D:\workspace\f\target\classes
  48. [INFO]
  49. [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ f2_maven ---
  50. [INFO] Using 'UTF-8' encoding to copy filtered resources.
  51. [INFO] skip non existing resourceDirectory D:\workspace\f\src\test\resources
  52. [INFO]
  53. [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ f2_maven ---
  54. [INFO] No sources to compile
  55. [INFO]
  56. [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ f2_maven ---
  57. [INFO] No tests to run.
  58. [INFO]
  59. [INFO] --- maven-war-plugin:2.3:war (default-war) @ f2_maven ---
  60. [INFO] Packaging webapp
  61. [INFO] Assembling webapp [f2_maven] in [D:\workspace\f\target\f2_maven]
  62. [INFO] Processing war project
  63. [INFO] Copying webapp webResources [D:\workspace\f\web/] to [D:\workspace\f\target\f2_maven]
  64. [INFO] Copying webapp webResources [D:\workspace\f\src/main/resources] to [D:\workspace\f\target\f2_maven]
  65. [INFO] Webapp assembled in [184335 msecs]
  66. [INFO] Building war: D:\workspace\f\target\f2_maven.war
  67. [INFO] ------------------------------------------------------------------------
  68. [INFO] BUILD SUCCESS
  69. [INFO] ------------------------------------------------------------------------
  70. [INFO] Total time: 07:07 min
  71. [INFO] Finished at: 2019-03-22T18:32:03+08:00
  72. [INFO] Final Memory: 59M/1402M
  73. [INFO] ------------------------------------------------------------------------
  74. D:\workspace\f>

方式二、安装到仓库中

如下所示:

  1. <dependency>
  2. <groupId>org.jbarcode</groupId>
  3. <artifactId>jbarcode</artifactId>
  4. <version>0.2.8</version>
  5. </dependency>
  6. <plugin>
  7. <groupId>org.apache.maven.plugins</groupId>
  8. <artifactId>maven-install-plugin</artifactId>
  9. <version>2.5.2</version>
  10. <executions>
  11. <execution>
  12. <id>install-external</id>
  13. <phase>clean</phase>
  14. <configuration>
  15. <file>${basedir}/web/WEB-INF/lib/jbarcode-0.2.8.jar</file>
  16. <repositoryLayout>default</repositoryLayout>
  17. <groupId>org.jbarcode</groupId>
  18. <artifactId>jbarcode</artifactId>
  19. <version>0.2.8</version>
  20. <generatePom>true</generatePom>
  21. </configuration>
  22. <goals>
  23. <goal>install-file</goal>
  24. </goals>
  25. </execution>
  26. </executions>
  27. </plugin>

发表评论

表情:
评论列表 (有 0 条评论,122人围观)

还没有评论,来说两句吧...

相关阅读