JavaSpring启动应用程序不是以带有AWS依赖项的maven命令行启动的
在我的SpringBoot项目中包含AWS对使用S3函数的依赖之后,该项目不会使用maven命令行运行
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.931</version>
</dependency>
已执行命令:
mvn spring-boot:run
错误消息:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.4:run (default-cli) on project my-project: Could not exec java: Cannot run program "C:\Program Files\Java\jdk-11.0.10\bin\java.exe" (in directory "C:\Users\usuario\Documents\repositories\my-project"): CreateProcess error=206, The filename or extension is too long -> [Help 1]
配置类:
@Configuration
public class AmazonConfig {
@Value(Constants.AMAZON_ACCESS_KEY_PROP)
private String accessKey;
@Value(Constants.AMAZON_SECRET_KEY_PROP)
private String secretKey;
@Value(Constants.S3_REGION_PROP)
private String region;
@Bean
public AmazonS3 s3() {
AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
return AmazonS3ClientBuilder.standard().withRegion(region).withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();
}
}
更多详情:
- 其他命令,如mvnclean和mvnpackage,工作得非常好李>
- 通过Eclipse运行应用程序也会失败
- 运行生成的Jar工作(java-jarmyjar.Jar)
- 我试图将项目移动到C://但错误相同
共 (0) 个答案