我想运行Junit来比较xml的响应。为此,我想使用org.xmlunit,我在我的pom中添加了依赖项,如下所示
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
然而,当我运行maven install时,我遇到了以下错误。我在eclipse中使用嵌入式maven(Mars Release(4.5.0))。有人可以帮我解决这个错误。
[错误]无法在项目springWSSecurityCertOrderSvc上执行目标:无法解析项目com.anvesh.spring.wssecurity的依赖项:springWSSecurityCertOrderSvc:war:0.0.1-SNAPSHOT:无法在org.xmlunit收集依赖项:xmlunit-core :jar:2.0.0:无法读取org.xmlunit的工件描述符:xmlunit-core:jar:2.0.0:无法传输工件org.xmlunit:xmlunit-core:pom:2.0.0 from / to central({ {3}}):连接超时 - &gt; [帮助1] org.apache.maven.lifecycle.LifecycleExecutionException:无法在项目springWSSecurityCertOrderSvc上执行目标:无法解析项目com.anvesh.spring.wssecurity的依赖项:springWSSecurityCertOrderSvc:war:0.0.1-SNAPSHOT:无法在org.xmlunit上收集依赖项:XMLUnit测试核心:罐子:2.0.0 在org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221) 在org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127) 在org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 在org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 在org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 在org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) 在org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) 在org.apache.maven.cli.MavenCli.main(MavenCli.java:197) 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) 在org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 在org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 在org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 在org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 引起:org.apache.maven.project.DependencyResolutionException:无法解析项目com.anvesh.spring.wssecurity的依赖项:springWSSecurityCertOrderSvc:war:0.0.1-SNAPSHOT:无法在org.xmlunit收集依赖项:xmlunit-core:罐子:2.0.0 在org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:180) 在org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195) ......还有23个 引起:org.eclipse.aether.collection.DependencyCollectionException:无法在org.xmlunit上收集依赖项:xmlunit-core:jar:2.0.0 at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:291) at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316) 在org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:172) ......还有24个 引起:org.eclipse.aether.resolution.ArtifactDescriptorException:无法读取org.xmlunit的工件描述符:xmlunit-core:jar:2.0.0 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:218) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:535) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:519) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254) ......还有26个 引起:org.eclipse.aether.resolution.ArtifactResolutionException:无法传输工件org.xmlunit:xmlunit-core:pom:2.0.0 from / to central(https://repo.maven.apache.org/maven2):connect timed out at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287) ......还有33个 引起:org.eclipse.aether.transfer.ArtifactTransferException:无法将工件org.xmlunit:xmlunit-core:pom:2.0.0从/向中央传输(https://repo.maven.apache.org/maven2):连接超时 at io.takari.aether.connector.AetherRepositoryConnector $ 2.wrap(AetherRepositoryConnector.java:895) at io.takari.aether.connector.AetherRepositoryConnector $ 2.wrap(AetherRepositoryConnector.java:1) at io.takari.aether.connector.AetherRepositoryConnector $ GetTask.flush(AetherRepositoryConnector.java:673) at io.takari.aether.connector.AetherRepositoryConnector.get(AetherRepositoryConnector.java:310) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520) 在org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421) ......还有36个 引起:java.net.SocketTimeoutException:连接超时 at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) 在java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) 在java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) 在java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) 在java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) 在java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 在java.net.Socket.connect(Socket.java:589) 在com.squareup.okhttp.internal.Platform.connectSocket(Platform.java:100) 在com.squareup.okhttp.Connection.connectSocket(Connection.java:196) 在com.squareup.okhttp.Connection.connect(Connection.java:172) 在com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:367) 在com.squareup.okhttp.OkHttpClient $ 1.connectAndSetOwner(OkHttpClient.java:128) 在com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:328) 在com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:245) 在com.squareup.okhttp.Call.getResponse(Call.java:267) 在com.squareup.okhttp.Call $ ApplicationInterceptorChain.proceed(Call.java:224) at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:195) 在com.squareup.okhttp.Call.execute(Call.java:79) at io.takari.aether.okhttp.OkHttpAetherClient.execute(OkHttpAetherClient.java:167) at io.takari.aether.okhttp.OkHttpAetherClient.get(OkHttpAetherClient.java:113) at io.takari.aether.connector.AetherRepositoryConnector $ GetTask.resumableGet(AetherRepositoryConnector.java:600) at io.takari.aether.connector.AetherRepositoryConnector $ GetTask.run(AetherRepositoryConnector.java:453) at io.takari.aether.connector.AetherRepositoryConnector.get(AetherRepositoryConnector.java:304) ......还有38个
答案 0 :(得分:1)
该工件在MavenCentral中可用,因此如果您无法下载它,您很可能遇到某种网络问题,导致您的Maven无法连接到MavenCentral的网址。这可能是代理(通常在大公司内部)或防火墙。
答案 1 :(得分:0)
检查您的连接,您无法连接maven中央存储库。
如果您使用Artifactory或Nexus,请检查您的外部存储库配置(Artifactory中的虚拟代理服务器)和代理连接。
如果您没有使用Artifactory或Nexus检查您与maven central的直接连接,可能您有代理限制。