使用spring-boot 1.2.5添加依赖项

问题描述 投票:0回答:1

我正在使用spring-1.2.5.BUILD-SNAPSHOT

当我尝试添加依赖项时,它表示无法收集依赖项

%> ./bin/spring install commons-io
Installing into: /Users/username/Downloads/spring-1.2.5.BUILD-SNAPSHOT/lib
Resolving dependencies...
startup failed:
General error during conversion: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact :commons-io:jar: in local (file:/Users/username/.m2/repository/)

org.springframework.boot.cli.compiler.grape.DependencyResolutionFailedException: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact :commons-io:jar: in local (file:/Users/username/.m2/repository/)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:304)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.grab(AetherGrapeEngine.java:112)
    at groovy.grape.Grape.grab(Grape.java:163)
    at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:358)
    at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:319)
    at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:923)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:585)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
    at org.springframework.boot.cli.compiler.GroovyCompiler.compile(GroovyCompiler.java:198)
    at org.springframework.boot.cli.command.install.GroovyGrabDependencyResolver.resolve(GroovyGrabDependencyResolver.java:55)
    at org.springframework.boot.cli.command.install.Installer.install(Installer.java:98)
    at org.springframework.boot.cli.command.install.InstallCommand$InstallOptionHandler.run(InstallCommand.java:57)
    at org.springframework.boot.cli.command.options.OptionHandler.run(OptionHandler.java:92)
    at org.springframework.boot.cli.command.OptionParsingCommand.run(OptionParsingCommand.java:53)
    at org.springframework.boot.cli.command.CommandRunner.run(CommandRunner.java:223)
    at org.springframework.boot.cli.command.CommandRunner.runAndHandleErrors(CommandRunner.java:172)
    at org.springframework.boot.cli.SpringCli.main(SpringCli.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact :commons-io:jar: in local (file:/Users/username/.m2/repository/)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:405)
    at org.springframework.boot.cli.compiler.grape.AetherGrapeEngine.resolve(AetherGrapeEngine.java:298)
    ... 23 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact :commons-io:jar: in local (file:/Users/username/.m2/repository/)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:462)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:264)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:388)
    ... 24 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact :commons-io:jar: in local (file:/Users/username/.m2/repository/)
    at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
    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:538)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:439)
    ... 26 more

1 error

因为我在~/.m2/repository安装了commons-io

%> ls ~/.m2/repository/commons-io/commons-io/2.6:
./  ../  _remote.repositories  commons-io-2.6.jar  commons-io-2.6.jar.sha1  commons-io-2.6.pom  commons-io-2.6.pom.sha1

它不应该抱怨丢失的文物..任何想法?

java spring spring-boot
1个回答
0
投票

你错过了commons-io。在依赖项下添加此节应该可以让您解决此问题:

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

我希望有所帮助。如果您有后续问题,请编辑您的问题并发表评论以吸引我。非常感谢!

编辑


./bin/spring jar ../test.jar index.groovy -- -cp $HOME/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar一样运行你的罐子应该排序你。如果您对此进行排序,请告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.