简体   繁体   中英

Spring boot cli DependencyResolutionFailedException

I am new to Spring boot and I want to start learning. I have installed Spring boot cli (Spring CLI v1.5.3.RELEASE) and I have created a simple server as below.

@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:

-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. 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. When I ran the spring command with this groovy program everything worked fine. No dependency errors, no complicated fiddling with options or proxy stuff was required.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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