Failed to read artifact descriptor for com.google.code.maven-svn-revision-number-plugin

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ththcc/article/details/88745353

1. 描述

最近使用Eclipse打包war包,每次都是没有什么大问题出现。可是当其他同事用命令行打包却出现一个奇怪的现象,报以下错误:

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]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building f2_maven 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.oschina.net/content/groups/public/com/google/code/maven-svn-revision-number-plugin/maven-svn-revision-nu
mber-plugin/1.7/maven-svn-revision-number-plugin-1.7.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.103 s
[INFO] Finished at: 2019-03-22T16:38:39+08:00
[INFO] Final Memory: 10M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin com.google.code.maven-svn-revision-number-plugin:maven-svn-revision-number-plugin:1.7 or one of its dependencies co
uld not be resolved: Failed to read artifact descriptor for com.google.code.maven-svn-revision-number-plugin:maven-svn-revision-nu
mber-plugin:jar:1.7: Could not transfer artifact com.google.code.maven-svn-revision-number-plugin:maven-svn-revision-number-plugin
:pom:1.7 from/to CN (http://maven.oschina.net/content/groups/public/): Failed to transfer file: http://maven.oschina.net/content/g
roups/public/com/google/code/maven-svn-revision-number-plugin/maven-svn-revision-number-plugin/1.7/maven-svn-revision-number-plugi
n-1.7.pom. Return code is: 503, ReasonPhrase: Service Unavailable. -> [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

D:\workspace\f>

2. 分析

这个问题很少见,网上没有多少例子说明,排除过程不好处理。查看ERROR提示的信息,可以发现这是该插件引用不了导致。删除中央仓库中的jar,再次执行打包命令,下载失败。通过Eclipse打包,下载是成功的!一般下载URL配置是在settings.xml中,通过查看D:\apache-maven-3.5.0-bin\conf\settings.xml发现,该文件没有配置repository,只有错误提示中出现的http://maven.oschina.net/content/groups/public/镜像。

<mirrors>
		<mirror>
			<id>CN</id>
			<name>OSChina Central</name>
			<url>http://maven.oschina.net/content/groups/public/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>
		<mirror>
			<id>aliyun</id>
			<name>aliyun</name>
			<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>
	</mirrors>

该镜像下载不了插件,所以运行也使用不了。再次查看C:\Users\nicoletang.m2\settings.xml文件,发现配置如下:

	<profiles>
			<profile>
				<id>nexus</id>
				<repositories>
					<repository>
						<id>maven2-repository.dev.java.net</id>
						<name>Java.net Repository for Maven</name>
						<url>http://download.java.net/maven/2/</url>
						<layout>default</layout>
					</repository>
					<repository>
						<id>central</id>
						<url>http://repo.maven.apache.org/maven2</url>
						<snapshots>
							<enabled>false</enabled>
						</snapshots>
					</repository>
					<repository>
						<id>ansj-repo</id>
						<name>ansj Repository</name>
						<url>http://maven.nlpcn.org/</url>
						<snapshots>
							<enabled>false</enabled>
						</snapshots>
					</repository>
				</repositories>
			</profile>
		</profiles>
		<mirrors>
			<mirror>
				<id>mirrorId</id>
				<mirrorOf>repositoryId</mirrorOf>
				<name>Human Readable
					Name for this Mirror.</name>
				<url>http://my.repository.com/repo/path</url>
			</mirror>
		</mirrors>

3. 解决方法

经过对比,CMD命名窗口使用的是D:\apache-maven-3.5.0-bin\conf\settings.xml的仓库路径,而Eclipse里配置的是C:\Users\nicoletang.m2\settings.xml,两个文件引用不一致,因此也就导致编译结果不同。改为一致后,编译成功!

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]
[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] ------------------------------------------------------------------------
[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]
[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 180 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 [14961 msecs]
[INFO] Building war: D:\workspace\f\target\f2_maven.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.383 s
[INFO] Finished at: 2019-03-22T16:54:15+08:00
[INFO] Final Memory: 43M/482M
[INFO] ------------------------------------------------------------------------

D:\workspace\f>

猜你喜欢

转载自blog.csdn.net/ththcc/article/details/88745353
今日推荐