我正在尝试使用spring MVC设置一个Web应用程序。当maven尝试下载log4j的依赖项时,我正在“连接超时”。
以下是添加到pom.xml的依赖项:
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
以下是错误消息:
[ERROR] Failed to execute goal on project FirstTestProject: Could not resolve dependencies for project com.nikhil.projects:FirstTestProject:war:0.0.1-SNAPSHOT: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), org.springframework:spring-core:jar:3.2.4.RELEASE (compile), org.springframework:spring-beans:jar:3.2.4.RELEASE (compile), org.springframework:spring-aop:jar:3.2.3.RELEASE (compile), org.springframework:spring-context:jar:3.2.3.RELEASE (compile), org.springframework:spring-expression:jar:3.2.3.RELEASE (compile), org.springframework:spring-web:jar:3.2.3.RELEASE (compile), org.springframework:spring-webmvc:jar:3.2.3.RELEASE (compile), javax.servlet:javax.servlet-api:jar:3.0.1 (compile), log4j:log4j:jar:1.2.17 (compile)]: Failed to read artifact descriptor for log4j:log4j:jar:1.2.17: Could not transfer artifact log4j:log4j:pom:1.2.17 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.pom -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project FirstTestProject: Could not resolve dependencies for project com.nikhil.projects:FirstTestProject:war:0.0.1-SNAPSHOT: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), org.springframework:spring-core:jar:3.2.4.RELEASE (compile), org.springframework:spring-beans:jar:3.2.4.RELEASE (compile), org.springframework:spring-aop:jar:3.2.3.RELEASE (compile), org.springframework:spring-context:jar:3.2.3.RELEASE (compile), org.springframework:spring-expression:jar:3.2.3.RELEASE (compile), org.springframework:spring-web:jar:3.2.3.RELEASE (compile), org.springframework:spring-webmvc:jar:3.2.3.RELEASE (compile), javax.servlet:javax.servlet-api:jar:3.0.1 (compile), log4j:log4j:jar:1.2.17 (compile)]
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.nikhil.projects:FirstTestProject:war:0.0.1-SNAPSHOT: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), org.springframework:spring-core:jar:3.2.4.RELEASE (compile), org.springframework:spring-beans:jar:3.2.4.RELEASE (compile), org.springframework:spring-aop:jar:3.2.3.RELEASE (compile), org.springframework:spring-context:jar:3.2.3.RELEASE (compile), org.springframework:spring-expression:jar:3.2.3.RELEASE (compile), org.springframework:spring-web:jar:3.2.3.RELEASE (compile), org.springframework:spring-webmvc:jar:3.2.3.RELEASE (compile), javax.servlet:javax.servlet-api:jar:3.0.1 (compile), log4j:log4j:jar:1.2.17 (compile)]
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:158)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:185)
... 22 more
Caused by: org.sonatype.aether.collection.DependencyCollectionException: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), org.springframework:spring-core:jar:3.2.4.RELEASE (compile), org.springframework:spring-beans:jar:3.2.4.RELEASE (compile), org.springframework:spring-aop:jar:3.2.3.RELEASE (compile), org.springframework:spring-context:jar:3.2.3.RELEASE (compile), org.springframework:spring-expression:jar:3.2.3.RELEASE (compile), org.springframework:spring-web:jar:3.2.3.RELEASE (compile), org.springframework:spring-webmvc:jar:3.2.3.RELEASE (compile), javax.servlet:javax.servlet-api:jar:3.0.1 (compile), log4j:log4j:jar:1.2.17 (compile)]
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for log4j:log4j:jar:1.2.17
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
... 25 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact log4j:log4j:pom:1.2.17 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.pom
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
... 28 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact log4j:log4j:pom:1.2.17 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.pom
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$3.wrap(AsyncRepositoryConnector.java:1546)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$3.wrap(AsyncRepositoryConnector.java:1537)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.flush(AsyncRepositoryConnector.java:1035)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector.get(AsyncRepositoryConnector.java:409)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:457)
... 31 more
Caused by: java.net.ConnectException: connection timed out to http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.pom
at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:95)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:381)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:372)
at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:334)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processConnectTimeout(NioClientSocketPipelineSink.java:374)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:283)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: connection timed out
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processConnectTimeout(NioClientSocketPipelineSink.java:371)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:283)
... 3 more
答案 0 :(得分:4)
试试这个:
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
上面的版本在这里显示0个字节:
http://mvnrepository.com/artifact/log4j/log4j
因此可能是一个腐败的工件
这可能只是该页面上的一个问题,因此,如果这无法帮助您查看运行它的位置,可以访问:http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.pom
如果以上内容没有帮助,您可能需要发布settings.xml。