web-dev-qa-db-ja.com

Mavenビルドの問題-リポジトリへの接続が拒否されました

利用可能なコードへの変更をインポート、変更、再構築、テスト、プッシュ/チェックインしたい このGithubリポジトリ内

現在、この目的のためにIDEまたはプラグインを使用したくない。

WindowsマシンにMavenをインストールし、以下に示すインストール手順に従って進めました。

C:\Documents and Settings\298790\My Documents\Downloads\seismichadoop-master>mvn
 -X package
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:
28+0530)
Maven home: D:\Omkar\Development\Softwares\Tools\Apache-maven-3.0.5
Java version: 1.6.0_20, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_20\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", Arch: "x86", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from D:\Omkar\Development\Softwares\Tools\Apache
-maven-3.0.5\conf\settings.xml
[DEBUG] Reading user settings from C:\Documents and Settings\298790\.m2\settings
.xml
[DEBUG] Using local repository at C:\Documents and Settings\298790\.m2\repositor
y
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Doc
uments and Settings\298790\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.cloudera.seismic:seismic:jar:0.1.0: (no
ne)
[DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.co
re, parent: null]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.cloudera.seismic:seismic:jar:0.1.0
[DEBUG] Tasks:   [package]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building seismic 0.1.0
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-so
urces, generate-resources, process-resources, compile, process-classes, generate
-test-sources, process-test-sources, generate-test-resources, process-test-resou
rces, test-compile, process-test-classes, test, prepare-package, package, pre-in
tegration-test, integration-test, post-integration-test, verify, install, deploy
]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo
.maven.Apache.org/maven2
Downloading: http://repo.maven.Apache.org/maven2/org/Apache/maven/plugins/maven-
resources-plugin/2.5/maven-resources-plugin-2.5.pom
[DEBUG] Writing resolution tracking file C:\Documents and Settings\298790\.m2\re
pository\org\Apache\maven\plugins\maven-resources-plugin\2.5\maven-resources-plu
gin-2.5.pom.lastUpdated
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.573s
[INFO] Finished at: Fri May 24 12:05:55 IST 2013
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.Apache.maven.plugins:maven-resources-plugin:2.5 or one of its
 dependencies could not be resolved: Failed to read artifact descriptor for org.
Apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact
 org.Apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http:/
/repo.maven.Apache.org/maven2): Connection to http://repo.maven.Apache.org refus
ed: Connection timed out: connect -> [Help 1]
org.Apache.maven.plugin.PluginResolutionException: Plugin org.Apache.maven.plugi
ns:maven-resources-plugin:2.5 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.Apache.maven.plugins:maven-resources-
plugin:jar:2.5
        at org.Apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re
solve(DefaultPluginDependenciesResolver.Java:129)
        at org.Apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginD
escriptor(DefaultMavenPluginManager.Java:142)
        at org.Apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDes
criptor(DefaultMavenPluginManager.Java:261)
        at org.Apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(D
efaultBuildPluginManager.Java:185)
        at org.Apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalc
ulator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.Java:152)
        at org.Apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalc
ulator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.Java:139)
        at org.Apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalc
ulator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.Java:116)
        at org.Apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalc
ulator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.Java:129)
        at org.Apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(Bu
ilderCommon.Java:92)
        at org.Apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.Java:81)
        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: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(NativeMethodAccessorImpl.
Java:39)
        at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.Java:25)
        at Java.lang.reflect.Method.invoke(Method.Java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.Java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.Java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.Java:
352)
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to
 read artifact descriptor for org.Apache.maven.plugins:maven-resources-plugin:ja
r:2.5
        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.DefaultRepositorySystem.readArtifac
tDescriptor(DefaultRepositorySystem.Java:279)
        at org.Apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re
solve(DefaultPluginDependenciesResolver.Java:115)
        ... 25 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not
 transfer artifact org.Apache.maven.plugins:maven-resources-plugin:pom:2.5 from/
to central (http://repo.maven.Apache.org/maven2): Connection to http://repo.mave
n.Apache.org refused
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def
aultArtifactResolver.Java:538)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti
facts(DefaultArtifactResolver.Java:216)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti
fact(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 tra
nsfer artifact org.Apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to c
entral (http://repo.maven.Apache.org/maven2): Connection to http://repo.maven.ap
ache.org refused
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(W
agonRepositoryConnector.Java:951)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(W
agonRepositoryConnector.Java:941)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.
run(WagonRepositoryConnector.Java:669)
        at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(Run
nableErrorForwarder.Java:60)
        at Java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.Java:886)
        at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.Java:908)
        at Java.lang.Thread.run(Thread.Java:619)
Caused by: org.Apache.maven.wagon.TransferFailedException: Connection to http://
repo.maven.Apache.org refused
        at org.Apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInput
Data(AbstractHttpClientWagon.Java:892)
        at org.Apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.Java:11
6)
        at org.Apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.Java:88)
        at org.Apache.maven.wagon.StreamWagon.get(StreamWagon.Java:61)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.
run(WagonRepositoryConnector.Java:601)
        ... 4 more
Caused by: org.Apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnect
Exception: Connection to http://repo.maven.Apache.org refused
        at org.Apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultCli
entConnectionOperator.openConnection(DefaultClientConnectionOperator.Java:190)
        at org.Apache.maven.wagon.providers.http.httpclient.impl.conn.ManagedCli
entConnectionImpl.open(ManagedClientConnectionImpl.Java:294)
        at org.Apache.maven.wagon.providers.http.httpclient.impl.client.DefaultR
equestDirector.tryConnect(DefaultRequestDirector.Java:645)
        at org.Apache.maven.wagon.providers.http.httpclient.impl.client.DefaultR
equestDirector.execute(DefaultRequestDirector.Java:480)
        at org.Apache.maven.wagon.providers.http.httpclient.impl.client.Abstract
HttpClient.execute(AbstractHttpClient.Java:906)
        at org.Apache.maven.wagon.providers.http.httpclient.impl.client.Abstract
HttpClient.execute(AbstractHttpClient.Java:805)
        at org.Apache.maven.wagon.shared.http4.AbstractHttpClientWagon.execute(A
bstractHttpClientWagon.Java:746)
        at org.Apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInput
Data(AbstractHttpClientWagon.Java:886)
        ... 8 more
Caused by: Java.net.ConnectException: Connection timed out: connect
        at Java.net.PlainSocketImpl.socketConnect(Native Method)
        at Java.net.PlainSocketImpl.doConnect(PlainSocketImpl.Java:333)
        at Java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.Java:195)
        at Java.net.PlainSocketImpl.connect(PlainSocketImpl.Java:182)
        at Java.net.SocksSocketImpl.connect(SocksSocketImpl.Java:366)
        at Java.net.Socket.connect(Socket.Java:529)
        at org.Apache.maven.wagon.providers.http.httpclient.conn.scheme.PlainSoc
ketFactory.connectSocket(PlainSocketFactory.Java:127)
        at org.Apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultCli
entConnectionOperator.openConnection(DefaultClientConnectionOperator.Java:180)
        ... 15 more
[ERROR]
[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

接続拒否エラーを取得しているURLにアクセスしようとしました:

http://repo.maven.Apache.org

Browsing for this directory has been disabled.

View this directory's contents on http://search.maven.org instead.

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>

  <groupId>com.cloudera.seismic</groupId>
  <artifactId>seismic</artifactId>
  <version>0.1.0</version>
  <packaging>jar</packaging>

  <name>seismic</name>

  <dependencies>
    <dependency>
      <groupId>org.Apache.hadoop</groupId>
      <artifactId>hadoop-core</artifactId>
      <version>1.0.3</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.Apache.crunch</groupId>
      <artifactId>crunch</artifactId>
      <version>0.4.0-incubating</version>
    </dependency>

    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.2</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.1</version>
    </dependency>

    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.4</version>
    </dependency>

    <dependency>
      <groupId>commons-httpclient</groupId>
      <artifactId>commons-httpclient</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>maven-hadoop</id>
      <name>Hadoop Releases</name>
      <url>https://repository.cloudera.com/content/repositories/releases/</url>
    </repository>
  </repositories>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-Assembly-plugin</artifactId>
        <version>2.2.1</version>
        <configuration>
          <descriptors>
            <descriptor>src/main/Assembly/hadoop-job.xml</descriptor>
          </descriptors>
          <archive>
            <manifest>
              <mainClass>com.cloudera.seismic.segy.Main</mainClass>
            </manifest>
          </archive>
        </configuration>
        <executions>
          <execution>
            <id>make-Assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
13

ほとんどの場合、プロキシの背後にいます。

telnet repo.maven.Apache.org 80そしておそらくあなたはそれが接続に失敗したことがわかるでしょう。

Settings.xmlで、対応するプロキシ設定を追加して、プロキシを通過してアーティファクトをダウンロードするようにMavenに指示します

<settings>
    .......
    <proxies>
        <proxy>
            <active>true</active>
            <protocol>http</protocol>
            <Host>your_proxy_Host</Host>
            <port>your_proxy_port</port>
            <!--
            <username>proxyuser</username>
            <password>somepassword</password>
            <nonProxyHosts>*.yourdomain.com|*.yourOtherDomain.com</nonProxyHosts>
            -->
        </proxy>
    </proxies>
</settings>
36
Adrian Shum