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

2023-05-16

1. 描述

使用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]
	<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>

2. 分析
systemPath被设计用来讲一些系统库包含进来,它们往往具有固定的路径。当在自己的project中使用这个特性但是指定相对路径如${basedir}/src/lib之类的,就会提示这个。通过网络搜索,发现解决的方案还是有的。

3. 解决方法
方式一、将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>

更改后,警告消失:

D:\workspace\f>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building f2_maven 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-svn-revision-number-plugin:1.7:revision (default) @ f2_maven ---
[INFO] inspecting D:\workspace\f
[INFO]   prefix = prefix
[INFO]   depth = empty
[INFO]   report unversioned = true
[INFO]   report ignored = false
[INFO]   report out-of-date = false
[INFO]  collecting status information
[INFO]         7213   7213 D:\workspace\f
[INFO]  setting properties
[INFO]   prefix.repository =
[INFO]   prefix.path =
[INFO]   prefix.revision = 7213
[INFO]   prefix.mixedRevisions = false
[INFO]   prefix.committedRevision = 7213
[INFO]   prefix.committedDate = 2019-03-19 18:00:51 +0800 (Tue, 19 Mar 2019)
[INFO]   prefix.status =
[INFO]   prefix.specialStatus =
[INFO]
[INFO] --- maven-clean-plugin:2.3:clean (auto-clean) @ f2_maven ---
[INFO] Deleting file set: D:\workspace\f\target (included: [**], excluded: [])
[INFO]
[INFO] --- build-helper-maven-plugin:1.8:add-resource (add-resource) @ f2_maven ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) @ f2_maven ---
[INFO] Source directory: D:\workspace\f\src\base\java added.
[INFO] Source directory: D:\workspace\f\src\pcfault\java added.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ f2_maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 6 resources
[INFO] Copying 1 resource
[INFO] Copying 8 resources
[INFO] Copying 10 resources
[INFO] Copying 7 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ f2_maven ---
[INFO] Compiling 3467 source files to D:\workspace\f\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ f2_maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\workspace\f\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ f2_maven ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ f2_maven ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.3:war (default-war) @ f2_maven ---
[INFO] Packaging webapp
[INFO] Assembling webapp [f2_maven] in [D:\workspace\f\target\f2_maven]
[INFO] Processing war project
[INFO] Copying webapp webResources [D:\workspace\f\web/] to [D:\workspace\f\target\f2_maven]
[INFO] Copying webapp webResources [D:\workspace\f\src/main/resources] to [D:\workspace\f\target\f2_maven]
[INFO] Webapp assembled in [184335 msecs]
[INFO] Building war: D:\workspace\f\target\f2_maven.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:07 min
[INFO] Finished at: 2019-03-22T18:32:03+08:00
[INFO] Final Memory: 59M/1402M
[INFO] ------------------------------------------------------------------------

D:\workspace\f>

 

方式二、安装到仓库中

如下所示:

	<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>

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

[WARNING] 'dependencies.dependency.systemPath' for... 的相关文章

  • Python 中的循环导入依赖项[重复]

    这个问题在这里已经有答案了 假设我有以下目录结构 a init py b init py c init py c file py d init py d file py In the a包的 init py the c包已导入 但c fil
  • 有没有一种简单的方法可以将 vulture 与 django 一起使用?

    我正在尝试清理 django 中一些混乱的遗留代码 Vulture http pypi python org pypi vulture看起来是一个不错的选择 但它似乎不知道如何查找 urls py 引用的视图函数 这并不奇怪 因为大多数函数
  • 我应该关心大量的依赖关系吗?

    我正要包括HtmlUnit http htmlunit sourceforge net项目中的库 我解压了 zip 文件 发现它不少于12 个依赖项 http htmlunit sourceforge net dependencies ht
  • 新的 TypeScript 版本不包括“window.navigator.msSaveBlob”

    我有一个 TypeScript 项目 https github com jmaister excellentexport https github com jmaister excellentexport 并且工作正常 添加dependab
  • Android Studio 无法解析 Espresso 3.0.0

    根据Android Espresso 文档 https developer android com training testing espresso setup html迄今为止 添加 Espresso 依赖项 要将 Espresso 依
  • 仅使用 Perl 核心运行单个脚本来自动安装缺少的模块的快速方法是什么?

    我继承了一个应该能够部署到其他服务器的项目 该项目有许多简单的模块依赖项 但这些依赖项可能并不存在于所有目标计算机上 因此 我希望能够运行一个命令行脚本来检查安装了哪些 Perl 模块 并尝试通过 CPAN 自动安装缺少的模块 由于这应该是
  • SBT 未解决 Squeryl 依赖关系

    我最近开始了一个新项目 Play 框架和Scala 我习惯于使用 Squeryl 进行 ORM 但由于某种原因 这次它无法解决我的依赖关系 尽管它会解决其他问题 只是不能解决 squeryl 问题 我所做的唯一不同的是 我使用的计算机与以前
  • 保持 Android Studio 的特定依赖顺序

    我正在尝试在 Android Studio 中使用 Robolectric 运行单元测试 我快到了 我明白了 JUnit version 3 8 or later expected java lang RuntimeException St
  • Gradle 多项目定义对根项目的依赖

    我有一个多项目 gradle 构建 以这种方式配置 root projectA projectB 我想在root build gradle所有嵌套项目的依赖项 这是文件 subprojects version 1 0 SNAPSHOT re
  • 跳过 Maven 测试依赖项

    我正在开发一个使用 Maven 进行构建的项目 我想做的是跳过测试依赖项 基本上在我的 Maven 存储库中不存在工件的情况下运行 Maven 构建 eg
  • 如何解决SBT依赖的依赖冲突?

    我有一个项目的构建 sbt正在使用 libraryDependencies Seq com lerestau killer launcher 1 0 2 com lerestau menu starter 1 0 0 菜单启动器过渡下载 杀
  • 跟踪 Maven 中的托管依赖项版本

    假设我有一个复杂的项目 有很多依赖项 依赖项的版本由大量导入范围 pom 管理 我的项目依赖于工件group artifact 它依赖于工件group transitive dependency 当我跑步时dependency tree我看
  • 在 Gradle 中跳过禁用任务的依赖执行?

    是否有可能not当任务将被跳过时执行该任务的依赖项 在下面的例子中 我想jar 以及依赖项jar to not执行时如果服务器已经在运行则执行runServerTests 在这种情况下 服务器将由另一个进程启动 apply plugin j
  • 作曲家和 Yii

    我使用 Composer 作为我的依赖管理器 因为我需要使用 Yii Framework 进行开发 所以我将其添加到我的composer json 文件中 所以它看起来像这样 other properties require other d
  • 自动 npm install --legacy-peer-deps 用于单个依赖项

    假设我有一个package json像这样 name my app version 0 1 0 dependencies aws sdk client s3 3 21 0 testing library react 11 2 5 axios
  • VS C# 中的依赖地狱,找不到依赖项

    我创建了一个图表 C 库 我们称之为chartlibrary 它本身依赖于多个第三方 dll 文件 在另一个可执行项目中 我们称之为chartuser 我参考了chartlibrary项目 两个项目位于 Visual Studio 中的同一
  • 如何管理 OSGi 构建依赖项?

    我们已将 OSGi 运行时 Equinox 嵌入到自定义客户端 服务器应用程序中 以促进插件开发 到目前为止一切进展顺利 由于 Eclipse 内置的清单编辑器 依赖项管理和导出向导 我们一直使用 Eclipse 来构建插件 使用 Ecli
  • Gradle创建多项目Jar

    因此 从 Gradle 和 Android Studio 诞生之初起 我就一直在使用它们 然而 我发现自己用头撞墙的次数有时远远超过了它的价值 我花了一天半的时间试图解决我目前的困境 在我工作的地方 我们使用很多共享库项目 这意味着与 Gr
  • 如何查看 Maven pom.xml 文件的传递依赖关系?

    有没有一个 CLI 工具可以用来快速查看 Maven 的传递依赖关系pom xml file 在 CLI 上 使用mvn dependency tree http maven apache org plugins maven depende
  • 如何查找引用特定 dll 的所有程序集?

    我有一个包含大量内容的目录dlls 我需要找到所有引用特定内容的内容dll 我正在考虑以下解决方案 循环程序集并调用每个程序集ildasm 转储manifest到一个文本文件中 在文本文件中搜索所需的程序集名称 然而这个解决方案对我来说是非

随机推荐