简体   繁体   English

Spring boot cli DependencyResolutionFailedException

[英]Spring boot cli DependencyResolutionFailedException

I am new to Spring boot and I want to start learning.我是 Spring Boot 的新手,我想开始学习。 I have installed Spring boot cli (Spring CLI v1.5.3.RELEASE) and I have created a simple server as below.我已经安装了 Spring boot cli (Spring CLI v1.5.3.RELEASE),并且创建了一个简单的服务器,如下所示。

@RestController
class WebApplication {

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

}

I also set:我还设置了:

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

Set also JAVA_OPTS, still not working:也设置了JAVA_OPTS,还是不行:

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

Started the server:启动服务器:

spring run hello.groovy 

I get the exception:我得到了例外:

> 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

I faced the same issue when I try to run the sample Hello World program in Spring boot CLI V1.5.4.当我尝试在 Spring boot CLI V1.5.4 中运行示例 Hello World 程序时,我遇到了同样的问题。 This is what I did and it started working after that.这就是我所做的,之后它就开始工作了。

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

It worked.有效。

cmd>set java_tool_options=-DproxySet=true -DproxyHost=proxy.host -DproxyPort=port
cmd>spring run app.groovy

is work for me.是为我工作。

I was also trying the same starter example.我也在尝试相同的入门示例。 I found that using a newer release was the answer.我发现使用较新版本是答案。 Today I just downloaded spring-boot-cli 2.3.3 Release.今天我刚刚下载了 spring-boot-cli 2.3.3 Release。 When I ran the spring command with this groovy program everything worked fine.当我用这个 groovy 程序运行 spring 命令时,一切正常。 No dependency errors, no complicated fiddling with options or proxy stuff was required.没有依赖错误,不需要复杂的选项或代理的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM