运行Grails CLI时出错:未知主机(504)

时间:2018-01-09 14:46:58

标签: grails grails3

当我尝试启动grails 3.3.2时出现错误Unknown Host (504),详情如下:

$ grails --stacktrace --verbose
| Error Error occurred running Grails CLI: Unknown Host (504)
org.apache.http.client.HttpResponseException: Unknown Host (504)
    at org.eclipse.aether.transport.http.HttpTransporter.handleStatus(HttpTransporter.java:466)
    at org.eclipse.aether.transport.http.HttpTransporter.execute(HttpTransporter.java:291)
    at org.eclipse.aether.transport.http.HttpTransporter.implPeek(HttpTransporter.java:231)
    at org.eclipse.aether.spi.connector.transport.AbstractTransporter.peek(AbstractTransporter.java:43)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$PeekTaskRunner.runTask(BasicRepositoryConnector.java:376)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
    at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
    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:320)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
    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)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:341)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:319)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:301)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:293)
    at org.grails.cli.boot.GrailsDependencyVersions.<init>(GrailsDependencyVersions.groovy:53)
    at org.grails.cli.boot.GrailsDependencyVersions.<init>(GrailsDependencyVersions.groovy:49)
    at org.grails.cli.profile.repository.MavenProfileRepository.<init>(MavenProfileRepository.groovy:53)
    at org.grails.cli.GrailsCli.createMavenProfileRepository(GrailsCli.groovy:334)
    at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:235)
    at org.grails.cli.GrailsCli.main(GrailsCli.groovy:159)
| Error Error occurred running Grails CLI: Unknown Host (504)

这是我的版本信息:

$ grails -v
| Grails Version: 3.3.2
| Groovy Version: 2.4.13
| JVM Version: 1.8.0_121

额外信息:我在代理网络后面的Mac上运行它。我已将以下声明添加到我的bin/grails/Users/foouser/.sdkman/candidates/grails/current/bin/grails)脚本中:

export GRAILS_OPTS="-Dhttp.proxyHost=myHttpProxy -Dhttp.proxyPort=8000 -Dhttps.proxyHost=myHttpsProxy -Dhttps.proxyPort=443"

1 个答案:

答案 0 :(得分:1)

经过几次试验和错误后,我发现org.eclipse.aether.internal.impl.DefaultRepositorySystem实际上是在尝试读取和解析我的$ HOME / .m2 / settings.xml。下面是我原来的settings.xml

<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
  xmlns="http://maven.apache.org/SETTINGS/1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <proxies>
    <proxy>
        <id>proxy</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>myHttpProxy</host>
        <port>8000</port>
    </proxy>
    <proxy>
        <id>httpsproxy</id>
        <active>true</active>
        <protocol>https</protocol>
        <host>myHttpProxy</host>
        <port>443</port>
    </proxy>
  </proxies>
  <servers>
    <server>
      <username>myname</username>
      <password>mypassword</password>
      <id>Artifactory</id>
    </server>
  </servers>
  <mirrors>
    <mirror>
      <id>Artifactory</id>
      <!-- Drive all repositories through the Artifactory mirror  -->
      <mirrorOf>*</mirrorOf>
      <url>http://myartifactoryurl</url>
    </mirror>
  </mirrors>
</settings>

不幸的是,它没有得到很好的解析......

当前的解决方法(虽然不好)我的目的是将此settings.xml更改为maven中的默认值,但没有设置任何设置。