我们在构建系统中使用maven 3.3.3版本,而在本地系统中使用maven 3.5.0版本。使用3.5.0版本的maven,一切都运行得很好,它下载了所有的jars。但是对于maven 3.3.3,我们得到了以下错误:
[ERROR] Failed to collect dependencies at com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.8.1: Failed to read artifact descriptor for com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.8.1: Could not transfer artifact com.fasterxml.jackson.dataformat:jackson-dataformat-xml:pom:2.8.1 from/to central (http://build.dlh.de/artifactory/libs-release): Failed to transfer file: http://build.dlh.de/artifactory/libs-release/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.8.1/jackson-dataformat-xml-2.8.1.pom. Return code is: 400 , ReasonPhrase:Bad Request. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project lhopenapi-actuators: Could not resolve dependencies for project xxx:xxx:jar:1.0.0: Failed to collect dependencies at com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.8.1
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:139)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
at hudson.remoting.UserRequest.perform(UserRequest.java:210)
at hudson.remoting.UserRequest.perform(UserRequest.java:53)
at hudson.remoting.Request$2.run(Request.java:364)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)请您帮助进行以下查询:
请帮助我们解决这个问题。
以下是根据建议更新的补充资料:
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>lhopenapi-actuators</artifactId>
<version>1.0.0</version>
<name>Custom Actuators for Spring Boot</name>
<parent>
<groupId>com.sample</groupId>
<artifactId>lhopenapi-common-properties</artifactId>
<version>1.0.0</version>
</parent>
<properties>
<sonar.issue.ignore.multicriteria>e1</sonar.issue.ignore.multicriteria>
<sonar.issue.ignore.multicriteria.e1.ruleKey>squid:S00101</sonar.issue.ignore.multicriteria.e1.ruleKey>
<sonar.issue.ignore.multicriteria.e1.resourceKey>**/*RS.java</sonar.issue.ignore.multicriteria.e1.resourceKey>
<spring.version>4.3.11.RELEASE</spring.version>
<jackson.version>2.8.1</jackson.version>
<slf4j.version>1.7.19</slf4j.version>
<javax.servlet.version>3.0.1</javax.servlet.version>
<spring.boot.version>1.5.7.RELEASE</spring.boot.version>
<lhopenapi.errors.version>1.0.0</lhopenapi.errors.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>${jackson.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>${spring.boot.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>另外还有一个信息是jackson-databind与所有其他jars一起被正确下载,除了jackson-dataformat-xml。我们要用jenkins来构建这个包。
用户Settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\Users\anil\.m2\repository</localRepository>
<interactiveMode />
<usePluginRegistry />
<offline>false</offline>
<pluginGroups />
<mirrors>
<mirror>
<id>central</id>
<mirrorOf>*</mirrorOf>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>releases</name>
<url>http://repo1.maven.org/maven2/</url>
<releases>
<updatePolicy>always</updatePolicy>
<enabled>true</enabled>
</releases>
<snapshots>
<updatePolicy>always</updatePolicy>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>发布于 2018-03-12 17:40:50
要回答您的问题:
maven版本与其他应用程序jars有关联吗?像maven 3.5.0版本可以下载2.8.1版本的jackson-dataformat-xml和3.3.3不能下载吗?
不,maven应该工作得很好。
我们如何管理这种依赖关系(如果有的话)?
可能,这不是依赖问题,而是系统/客户端工具的问题。请从控制台尝试mvn clean install,并确保您有存储库访问权限。
编辑:基于OP注释
使用settings.xml更新的问题说明请帮助。我还没有在构建服务器上验证settings.xml。但它可以下载所有其他软件包,除了这个是我的担心。
settings.xml中提到的存储库是http://repo1.maven.org/maven2/,它确实有jar。

https://stackoverflow.com/questions/49237408
复制相似问题