Currently I have a Maven Project, after adding the following dependency: https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk to the pom.xml file, I seem to be seeing the following exception: CreateProcess error=206, The filename or extension is too long
When executing a class which contains public static void main
:
public class Connection_Test {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
I have currently moved the .m2 repo (I'm using windows 10) via the following:
- Move .m2 repository to c:\
- Create a settings.xml via inteliJ containing the following:
<settings>
<localRepository>c:/.m2/repository</localRepository>
</settings>
Even with the above settings / changes, I'm still experiencing the same issue, not sure why after adding the aws-java-sdk dependency I seem to run into the issue, any ideas?
The problem appears to be in the way the aws java libraries are imported through the pom.xml file. I've seen documentation and projects that do something like this:
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.12.1</version>
</dependency>
</dependencies>
However, it appears that there are now so many sub-projects under aws-java-sdk that listing them all breaks the maximum length classpath on Windows 10.
Instead of importing the entire AWS SDK, its better to only import the part that you need. There is some good documentation on that here.
To import SDK components one at a time, you need to first enable the aws-java-sdk-bom (Bill of Materials) in the pom.xml file's DependencyManagement section. Like so:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.12.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
And then, to bring in S3, you have to have aws-java-sdk-s3 listed as its own dependency.
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With