我正在尝试构建我的Maven项目,但它无法从中央仓库http://repo.maven.apache.org/maven2获取org / beanshell / bsh / 2.0b4 / bsh-2.0b4.jar
以下是我在命令行中使用mvn archetype:generate时的错误跟踪:
C:\Users\SO310400\workspace\analytics>mvn -U -e archetype:generate
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
metadata.xml
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadat
a.xml
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-m
etadata.xml (13 KB at 11.9 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata
.xml (20 KB at 15.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
archetype-plugin/maven-metadata.xml
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-a
rchetype-plugin/maven-metadata.xml (730 B at 1.1 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Credit Dashboard Analytics 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.3:generate (default-cli) @ analytics >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.3:generate (default-cli) @ analytics <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.3:generate (default-cli) @ analytics ---
Downloading: http://repo.maven.apache.org/maven2/org/beanshell/bsh/2.0b4/bsh-2.0
b4.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:05.313s
[INFO] Finished at: Tue Apr 07 13:10:12 IST 2015
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.3:generate (default-cli) on project analytics: Execution default-cli of goal or
g.apache.maven.plugins:maven-archetype-plugin:2.3:generate failed: Plugin org.ap
ache.maven.plugins:maven-archetype-plugin:2.3 or one of its dependencies could n
ot be resolved: Could not transfer artifact org.beanshell:bsh:jar:2.0b4 from/to
central (http://repo.maven.apache.org/maven2): GET request of: org/beanshell/bsh
/2.0b4/bsh-2.0b4.jar from central failed: Connection reset -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-archetype-plugin:2.3:generate (default-cli) on pro
ject analytics: Execution default-cli of goal org.apache.maven.plugins:maven-arc
hetype-plugin:2.3:generate failed: Plugin org.apache.maven.plugins:maven-archety
pe-plugin:2.3 or one of its dependencies could not be resolved: Could not transf
er artifact org.beanshell:bsh:jar:2.0b4 from/to central (http://repo.maven.apach
e.org/maven2): GET request of: org/beanshell/bsh/2.0b4/bsh-2.0b4.jar from centra
l failed
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:224)
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.buildProje
ct(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-c
li of goal org.apache.maven.plugins:maven-archetype-plugin:2.3:generate failed:
Plugin org.apache.maven.plugins:maven-archetype-plugin:2.3 or one of its depende
ncies could not be resolved: Could not transfer artifact org.beanshell:bsh:jar:2
.0b4 from/to central (http://repo.maven.apache.org/maven2): GET request of: org/
beanshell/bsh/2.0b4/bsh-2.0b4.jar from central failed
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:87)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:208)
... 19 more
Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.
maven.plugins:maven-archetype-plugin:2.3 or one of its dependencies could not be
resolved: Could not transfer artifact org.beanshell:bsh:jar:2.0b4 from/to centr
al (http://repo.maven.apache.org/maven2): GET request of: org/beanshell/bsh/2.0b
4/bsh-2.0b4.jar from central failed
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re
solve(DefaultPluginDependenciesResolver.java:208)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPlug
inRealm(DefaultMavenPluginManager.java:357)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPlugi
nRealm(DefaultMavenPluginManager.java:325)
at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm(Defa
ultBuildPluginManager.java:180)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:83)
... 20 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not
transfer artifact org.beanshell:bsh:jar:2.0b4 from/to central (http://repo.maven
.apache.org/maven2): GET request of: org/beanshell/bsh/2.0b4/bsh-2.0b4.jar from
central failed
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(Defa
ultArtifactResolver.java:459)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtif
acts(DefaultArtifactResolver.java:262)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDepen
dencies(DefaultRepositorySystem.java:367)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re
solve(DefaultPluginDependenciesResolver.java:200)
... 24 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not tran
sfer artifact org.beanshell:bsh:jar:2.0b4 from/to central (http://repo.maven.apa
che.org/maven2): GET request of: org/beanshell/bsh/2.0b4/bsh-2.0b4.jar from cent
ral failed
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(Wa
gonRepositoryConnector.java:1016)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(Wa
gonRepositoryConnector.java:1004)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.r
un(WagonRepositoryConnector.java:725)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(Runn
ableErrorForwarder.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.maven.wagon.TransferFailedException: GET request of: org/b
eanshell/bsh/2.0b4/bsh-2.0b4.jar from central failed
at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:3
49)
at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:3
10)
at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:2
87)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:97)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.r
un(WagonRepositoryConnector.java:660)
... 4 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:189)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at org.apache.maven.wagon.providers.http.httpclient.impl.io.AbstractSess
ionInputBuffer.read(AbstractSessionInputBuffer.java:204)
at org.apache.maven.wagon.providers.http.httpclient.impl.io.ContentLengt
hInputStream.read(ContentLengthInputStream.java:182)
at org.apache.maven.wagon.providers.http.httpclient.conn.EofSensorInputS
tream.read(EofSensorInputStream.java:138)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:493)
at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:3
39)
... 9 more
[ERROR]
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException
C:\Users\SO310400\workspace\analytics>
由于我在工作场所网络中使用代理环境,因此我在C:/Users/MYNAME/.m2/settings.xml中有代理设置(其中M2_REPO = C:/Users/MYNAME/.m2/repository )如下:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>MYNAME</username>
<password>MYPASSWORD</password>
<host>MYPROXYSERVER</host>
<port>MYPROXYPORT</port>
<nonProxyHosts>google.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
但我在项目POM中遇到以下错误(C:/Users/MYNAME/workspace/analytics/pom.xml)
cvc-complex-type.2.4.a: Invalid content was found starting with element 'snapshotRepository'. One of '{"http://
maven.apache.org/POM/4.0.0":repository}' is expected.
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-c
li of goal org.apache.maven.plugins:maven-archetype-plugin:2.3:generate failed:
Plugin org.apache.maven.plugins:maven-archetype-plugin:2.3 or one of its depende
ncies could not be resolved: Could not transfer artifact org.beanshell:bsh:jar:2
.0b4 from/to central (http://repo.maven.apache.org/maven2): GET request of: org/
beanshell/bsh/2.0b4/bsh-2.0b4.jar from central failed