0
votes

I wanted to run Junit which compares xml reponses. For this I want to use org.xmlunit and I have added dependency in my pom as below

<dependency>
    <groupId>org.xmlunit</groupId>
    <artifactId>xmlunit-core</artifactId>
    <version>2.0.0</version>
    <scope>test</scope>
</dependency>

However When I run maven install I am getting below error. I am using embedded maven in eclipse ( Mars Release (4.5.0)). Can someone help me to resolve this error.

[ERROR] Failed to execute goal on project springWSSecurityCertOrderSvc: Could not resolve dependencies for project com.anvesh.spring.wssecurity:springWSSecurityCertOrderSvc:war:0.0.1-SNAPSHOT: Failed to collect dependencies at org.xmlunit:xmlunit-core:jar:2.0.0: Failed to read artifact descriptor for org.xmlunit:xmlunit-core:jar:2.0.0: Could not transfer artifact org.xmlunit:xmlunit-core:pom:2.0.0 from/to central (https://repo.maven.apache.org/maven2): connect timed out -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project springWSSecurityCertOrderSvc: Could not resolve dependencies for project com.anvesh.spring.wssecurity:springWSSecurityCertOrderSvc:war:0.0.1-SNAPSHOT: Failed to collect dependencies at org.xmlunit:xmlunit-core:jar:2.0.0 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.apache.maven.cli.MavenCli.execute(MavenCli.java:862) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) at 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) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.anvesh.spring.wssecurity:springWSSecurityCertOrderSvc:war:0.0.1-SNAPSHOT: Failed to collect dependencies at org.xmlunit:xmlunit-core:jar:2.0.0 at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:180) at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195) ... 23 more Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at 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) at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:172) ... 24 more Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for 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 more Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact 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 more Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.xmlunit:xmlunit-core:pom:2.0.0 from/to central (https://repo.maven.apache.org/maven2): connect timed out 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) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421) ... 36 more Caused by: java.net.SocketTimeoutException: connect timed out at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at com.squareup.okhttp.internal.Platform.connectSocket(Platform.java:100) at com.squareup.okhttp.Connection.connectSocket(Connection.java:196) at com.squareup.okhttp.Connection.connect(Connection.java:172) at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:367) at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128) at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:328) at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:245) at com.squareup.okhttp.Call.getResponse(Call.java:267) at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:224) at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:195) at 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 more

2
What is unclear about the error message: Could not transfer artifact org.xmlunit:xmlunit-core:pom:2.0.0 from/to central (https://repo.maven.apache.org/maven2): connect timed out at ? Access issue to maven central from Eclipse..firewall/proxy issue...not using a repository manager not correctly configured settings.xml..khmarbaise
It is my mistake...firewall/proxy issue...thanksAnveshan

2 Answers

1
votes

The artifact is available in MavenCentral, so if you cannot download it, you most probably have some kind of network issue that prevents your Maven to connect to the url of MavenCentral. This could be a proxy (often inside larger companies) or a firewall.

0
votes

Check your connection, you can not connect with the maven central repository.

  • If you are using Artifactory or Nexus check your external repository configuration (virtual repsoitories in Artifactory) and proxy connection.

  • If you aren't using Artifactory or Nexus check your direct connection to maven central, probably you have a proxy limitation.