2017-04-25 153 views
0

我是Spring的新手,我想开始学习。我已经安装了Spring boot cli(Spring CLI v1.5.3.RELEASE),并且我已经创建了一个简单的服务器,如下所示。Spring boot cli DependencyResolutionFailedException

@RestController 
class WebApplication { 

    @RequestMapping("/") 
    String home() { 
     "Hello World!" 
    } 

} 

我还设置:

export proxy="proxy-info" 
export https-proxy="proxy-info" 
export http-proxy="proxy-info" 

设置也JAVA_OPTS,仍然没有工作:

-Dhttp.proxyHost=proxyhostURL 
-Dhttp.proxyPort=proxyPortNumber 
-Dhttp.proxyUser=someUserName 
-Dhttp.proxyPassword=somePassword 

启动服务器:

spring run hello.groovy 

我得到异常:

> Resolving dependencies.. startup failed: General error during 
> conversion: 
> org.eclipse.aether.resolution.DependencyResolutionException: Failed to 
> collect dependencies at 
> org.springframework.boot:spring-boot-starter:jar:1.5.3.RELEASE 
> 
> org.springframework.boot.cli.compiler.grape.DependencyResolutionFailedException: 
> org.eclipse.aether.resolution.DependencyResolutionException: Failed to 
> collect dependencies at 
> org.springframework.boot:spring-boot-starter:jar:1.5.3.RELEASE 
>   at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:324) 
>   at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.grab(AetherGrapeEngine.java:129) 
>   at groovy.grape.Grape.grab(Grape.java:167) 
>   at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:378) 
>   at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:321) 
>   at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943) 
>   at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605) 
>   at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581) 
>   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558) 
>   at org.springframework.boot.cli.compiler.GroovyCompiler.compile(GroovyCompiler.java:206) 
>   at org.springframework.boot.cli.command.run.SpringApplicationRunner.compile(SpringApplicationRunner.java:129) 
>   at org.springframework.boot.cli.command.run.SpringApplicationRunner.compileAndRun(SpringApplicationRunner.java:101) 
>   at org.springframework.boot.cli.command.run.RunCommand$RunOptionHandler.run(RunCommand.java:111) 
>   at org.springframework.boot.cli.command.options.OptionHandler.run(OptionHandler.java:84) 
>   at org.springframework.boot.cli.command.OptionParsingCommand.run(OptionParsingCommand.java:54) 
>   at org.springframework.boot.cli.command.CommandRunner.run(CommandRunner.java:219) 
>   at org.springframework.boot.cli.command.CommandRunner.runAndHandleErrors(CommandRunner.java:171) 
>   at org.springframework.boot.cli.SpringCli.main(SpringCli.java:63) 
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 

.... 

> 1 error 

回答

0

当我尝试在Spring启动CLI V1.5.4中运行示例Hello World程序时,我遇到了同样的问题。这就是我所做的,并在此之后开始工作。

cmd>set JAVA_OPTS=-Dhttp.proxyHost=<proxyhost.domain.com> -Dhttp.proxyPort=<port> 
cmd>spring run app.groovy 

它的工作。