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

博客主要讲述使用Maven打包时出现警告的问题。原因是引用本地lib包,使用systemPath指定相对路径所致。文中给出两种解决方法,一是进行修改,简单方便;二是将其安装到仓库中,更改后警告消失。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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>
[WARNING] [WARNING] Some problems were encountered while building the effective model for com.shuheyun:digitCore2-model:jar:1.0.5-SNAPSHOT [WARNING] 'dependencies.dependency.version' for com.alibaba:easyexcel:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 34, column 22 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.alibaba:easyexcel:jar -> version RELEASE vs 2.2.3 @ line 43, column 21 [WARNING] [WARNING] Some problems were encountered while building the effective model for com.shuheyun:digitCore2-admin:war:1.0.5-SNAPSHOT [WARNING] 'dependencies.dependency.version' for org.apache.httpcomponents:httpclient:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 176, column 22 [WARNING] 'dependencies.dependency.version' for org.apache.httpcomponents:httpclient:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 182, column 22 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.apache.httpcomponents:httpclient:jar -> duplicate declaration of version RELEASE @ line 179, column 21 [WARNING] 'dependencies.dependency.systemPath' for dop-sdk:dop-sdk:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/dop-sdk-0.0.1-SNAPSHOT.jar will be unresolvable by dependent projects @ line 207, column 25 [WARNING] 'dependencies.dependency.systemPath' for ebill-client:ebill-client:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/ebill-client.jar will be unresolvable by dependent projects @ line 214, column 25 [WARNING] 'dependencies.dependency.systemPath' for ezmorph:ezmorph:jar should not point at files within the project directory, ${project.basedir}/src/main/resources/lib/ezmorph-1.0.2.jar will be unresolvable by dependent projects @ line 221, column 25 [WARNING] 'dependencies.dependency.systemPath' for jaxb-impl:jaxb-impl:jar sh
03-26
> sudo mvn clean package [sudo] password for shl: [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.xkhy.tafang:tafang-server:jar:1.0-SNAPSHOT [WARNING] 'dependencies.dependency.systemPath' for com.cca:cca-agent:jar should not point at files within the project directory, ${project.basedir}/lib/cca-agent-0.0.2.jar will be unresolvable by dependent projects @ line 160, column 16 [WARNING] 'dependencies.dependency.systemPath' for com.cca:cca-core:jar should not point at files within the project directory, ${project.basedir}/lib/cca-core-0.0.39.jar will be unresolvable by dependent projects @ line 167, column 25 [WARNING] 'dependencies.dependency.systemPath' for com.cdi-api:cdi-api:jar should not point at files within the project directory, ${project.basedir}/lib/cdi-api-1.0.jar will be unresolvable by dependent projects @ line 174, 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] [INFO] [INFO] -------------------< com.xkhy.tafang:tafang-server >-------------------- [INFO] Building tafang-server 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The POM for com.xkhy.tafang:tafang-common:jar:0.0.12 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details / 解读一下警告。
最新发布
05-22
shl@DESKTOP-I8CQKFM:/mnt/e/m01.svn/truck/m03.client/Server/tafang-server$ sudo mvn clean package [sudo] password for shl: [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.xkhy.tafang:tafang-server:jar:1.0-SNAPSHOT [WARNING] 'dependencies.dependency.systemPath' for com.cca:cca-agent:jar should not point at files within the project directory, ${project.basedir}/lib/cca-agent-0.0.2.jar will be unresolvable by dependent projects @ line 160, column 16 [WARNING] 'dependencies.dependency.systemPath' for com.cca:cca-core:jar should not point at files within the project directory, ${project.basedir}/lib/cca-core-0.0.39.jar will be unresolvable by dependent projects @ line 167, column 16 [WARNING] 'dependencies.dependency.systemPath' for com.cdi-api:cdi-api:jar should not point at files within the project directory, ${project.basedir}/lib/cdi-api-1.0.jar will be unresolvable by dependent projects @ line 174, column 16 [WARNING] 'dependencies.dependency.systemPath' for org.apache.commons:commons-lang:jar should not point at files within the project directory, ${project.basedir}/lib/commons-lang-2.4.jar will be unresolvable by dependent projects @ line 201, column 16 [WARNING] 'dependencies.dependency.systemPath' for org.eclipse.jdt.core.compiler:ecj:jar should not point at files within the project directory, ${project.basedir}/lib/ecj-3.32.0.jar will be unresolvable by dependent projects @ line 223, column 16 [WARNING] 'dependencies.dependency.systemPath' for com.google.gson:gson:jar should not point at files within the project directory, ${project.basedir}/lib/gson-2.8.9.jar will be unresolvable by dependent projects @ line 240, column 16 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: redis.clients:jedis:jar -> duplicate declaration of version 4.2.3 @ line 287, column 15 [WARNING] 'dependencies.dependency.systemPath' for com.github.iarellano:json:jar should not point at files within the project directory, ${project.basedir}/lib/json-20211205.jar will be unresolvable by dependent projects @ line 307, column 16 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.projectlombok:lombok:jar -> duplicate declaration of version 1.18.22 @ line 349, column 15 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.codehaus.plexus:plexus-compiler-eclipse:jar -> duplicate declaration of version 2.13.0 @ line 444, column 15 [WARNING] 'dependencies.dependency.systemPath' for com.plexus-testing:plexus-testing:jar should not point at files within the project directory, ${project.basedir}/lib/plexus-testing-1.1.0.jar will be unresolvable by dependent projects @ line 459, column 16 [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] [INFO] [INFO] -------------------< com.xkhy.tafang:tafang-server >-------------------- [INFO] Building tafang-server 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/3.5.0/maven-jar-plugin-3.5.0.pom [WARNING] The POM for org.apache.maven.plugins:maven-jar-plugin:jar:3.5.0 is missing, no dependency information available Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/3.5.0/maven-jar-plugin-3.5.0.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.156 s [INFO] Finished at: 2025-05-21T11:32:08+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.apache.maven.plugins:maven-jar-plugin:3.5.0 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-jar-plugin:jar:3.5.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException shl@DESKTOP-I8CQKFM:/mnt/e/m01.svn/truck/m03.client/Server/tafang-server$
05-22
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值