Aws-sdk-java: Add module-info.java

Created on 18 Oct 2017  路  10Comments  路  Source: aws/aws-sdk-java

So that projects depend on this can be published to a public artifact repository.
Note that this is not breaking backward compatibility. All codes except this file can be still compiled in Java 6.

feature-request

Most helpful comment

Using automatic modules only works in some cases because there are split packages. For example, the package com.amazonaws.auth exists in both aws-java-sdk-s3 and aws-java-sdk-core giving the following error:

error: module demo reads package com.amazonaws.auth from both aws.java.sdk.core and aws.java.sdk.s3

All 10 comments

Using automatic modules only works in some cases because there are split packages. For example, the package com.amazonaws.auth exists in both aws-java-sdk-s3 and aws-java-sdk-core giving the following error:

error: module demo reads package com.amazonaws.auth from both aws.java.sdk.core and aws.java.sdk.s3

so whats the solution for now ?

The real issue here is split packages, effectively rendering the SDK unusable in a JPMS (jdk9 or later) runtime.

A relatively low-effort way of addressing this is to add an Automatic-Module-Name value to the MANIFEST.MF in each JAR file. This could be done in maven by adding something like:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <configuration>
    <archive>
      <manifestEntries>
        <Automatic-Module-Name>com.amazonaws.aws.java.sdk.iam</Automatic-Module-Name>
      </manifestEntries>
    </archive>
  </configuration>
</plugin>

This doesn't get around the modules dependencies, but it helps ensure that we don't get module naming collusions, etc..

Any update(s) on this? I have some code being used from v1 (as it doesn't exist yet in v2), and I'm encountering a split package on com.amazonaws.auth.

This is still a problem as of 1.11.480, the latest version on maven central

Any update on this issue?

Hey I'm migrating to jdk 11, is there any update about this ?

I think your best bet is to use the v2 sdk if you want to do modules. I doubt they will be fixing the split packages any time soon.

Thank you @akud! Worked fine.

Was this page helpful?
0 / 5 - 0 ratings