Module class loading

Hello all
Ive started the journey into module development and im currently facing the following issue. My module is using the AWS sdk and ive included the following in my build.gradle.kts gateway scope:

modlApi(platform("software.amazon.awssdk:bom:2.29.47"))
modlApi("software.amazon.awssdk:sdk-core")
modlApi("software.amazon.awssdk:auth")
modlApi("software.amazon.awssdk:aws-core")
modlApi("software.amazon.awssdk:s3")

When running some of the functions from a button event script im encountering an error:
NoSuchFieldError: java.lang.NoSuchFieldError:AUTH_SCHEME_PROVIDER

I added some additional logging to my gateway module hook to identify where the classes are being loaded from and found the following

GatewayHook 11Jan2025 20:02:54 Successfully loaded: software.amazon.awssdk.services.s3.S3Client from file:/usr/local/ignition/data/jar-cache/com.inductiveautomation.ignition.examples.scripting.ScriptingFunctionG/__957923360__s3-2.29.47.jar
GatewayHook 11Jan2025 20:02:54 Successfully loaded: software.amazon.awssdk.core.SdkClient from file:/usr/local/ignition/lib/core/gateway/sdk-core-2.20.7.jar
GatewayHook 11Jan2025 20:02:54 Successfully loaded: software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider from file:/usr/local/ignition/data/jar-cache/com.inductiveautomation.ignition.examples.scripting.ScriptingFunctionG/__957923360__auth-2.29.47.jar

It appears that classes in software.amazon.awssdk.core are being loaded from lib/core/gateway/sdk-core which is the igntion sdk core. I suspect this a name clash between the aws sdk-core jar and igntion sdk-core jar. Is there a way to fix this issue. Ive included my module.xml file for reference

Summary
<?xml version="1.0" encoding="UTF-8"?>
<modules>
	<module>
		<name>Scripting Function G</name>
		<id>com.inductiveautomation.ignition.examples.scripting.ScriptingFunctionG</id>
		<version>0.0.1-SNAPSHOT</version>
		<description>A short sentence describing what it does, but not much longer than this.</description>
		<requiredIgnitionVersion>8.1.11</requiredIgnitionVersion>
		<freeModule>false</freeModule>
		<hook scope="G">com.inductiveautomation.ignition.examples.scripting.gateway.GatewayHook</hook>
		<hook scope="C">com.inductiveautomation.ignition.examples.scripting.client.ClientHook</hook>
		<hook scope="D">com.inductiveautomation.ignition.examples.scripting.designer.DesignerHook</hook>
		<requiredFrameworkVersion>8</requiredFrameworkVersion>
		<jar scope="CD">client-0.0.1-SNAPSHOT.jar</jar>
		<jar scope="CDG">common-0.0.1-SNAPSHOT.jar</jar>
		<jar scope="D">designer-0.0.1-SNAPSHOT.jar</jar>
		<jar scope="G">s3-2.29.47.jar</jar>
		<jar scope="G">aws-xml-protocol-2.29.47.jar</jar>
		<jar scope="G">aws-query-protocol-2.29.47.jar</jar>
		<jar scope="G">protocol-core-2.29.47.jar</jar>
		<jar scope="G">arns-2.29.47.jar</jar>
		<jar scope="G">aws-core-2.29.47.jar</jar>
		<jar scope="G">auth-2.29.47.jar</jar>
		<jar scope="G">regions-2.29.47.jar</jar>
		<jar scope="G">sdk-core-2.29.47.jar</jar>
		<jar scope="G">profiles-2.29.47.jar</jar>
		<jar scope="G">crt-core-2.29.47.jar</jar>
		<jar scope="G">http-auth-2.29.47.jar</jar>
		<jar scope="G">http-auth-aws-2.29.47.jar</jar>
		<jar scope="G">http-auth-spi-2.29.47.jar</jar>
		<jar scope="G">identity-spi-2.29.47.jar</jar>
		<jar scope="G">checksums-2.29.47.jar</jar>
		<jar scope="G">checksums-spi-2.29.47.jar</jar>
		<jar scope="G">retries-2.29.47.jar</jar>
		<jar scope="G">retries-spi-2.29.47.jar</jar>
		<jar scope="G">apache-client-2.29.47.jar</jar>
		<jar scope="G">netty-nio-client-2.29.47.jar</jar>
		<jar scope="G">http-client-spi-2.29.47.jar</jar>
		<jar scope="G">metrics-spi-2.29.47.jar</jar>
		<jar scope="G">json-utils-2.29.47.jar</jar>
		<jar scope="G">utils-2.29.47.jar</jar>
		<jar scope="G">endpoints-spi-2.29.47.jar</jar>
		<jar scope="G">http-auth-aws-eventstream-2.29.47.jar</jar>
		<jar scope="G">annotations-2.29.47.jar</jar>
		<jar scope="G">reactive-streams-1.0.4.jar</jar>
		<jar scope="G">slf4j-api-1.7.36.jar</jar>
		<jar scope="G">eventstream-1.0.1.jar</jar>
		<jar scope="G">third-party-jackson-core-2.29.47.jar</jar>
		<jar scope="G">httpclient-4.5.13.jar</jar>
		<jar scope="G">httpcore-4.4.16.jar</jar>
		<jar scope="G">commons-codec-1.17.1.jar</jar>
		<jar scope="G">netty-codec-http2-4.1.115.Final.jar</jar>
		<jar scope="G">netty-codec-http-4.1.115.Final.jar</jar>
		<jar scope="G">netty-handler-4.1.115.Final.jar</jar>
		<jar scope="G">netty-codec-4.1.115.Final.jar</jar>
		<jar scope="G">netty-transport-classes-epoll-4.1.115.Final.jar</jar>
		<jar scope="G">netty-transport-native-unix-common-4.1.115.Final.jar</jar>
		<jar scope="G">netty-transport-4.1.115.Final.jar</jar>
		<jar scope="G">netty-buffer-4.1.115.Final.jar</jar>
		<jar scope="G">netty-resolver-4.1.115.Final.jar</jar>
		<jar scope="G">netty-common-4.1.115.Final.jar</jar>
		<jar scope="G">commons-logging-1.2.jar</jar>
		<jar scope="G">gateway-0.0.1-SNAPSHOT.jar</jar>
	</module>
</modules>

sdk-core-2.20.7.jar isn't one of our platform dependencies.

Did you maybe place it there yourself prior to trying to move all of this into a module?

Hmm, I take that back, I see it locally as well. I must have missed it in our build files.

I think your only option may be to use something like the Gradle shadow plugin to relocate software.amazon.awssdk.* into something like software.amazon.awssdk.shadowed.* at compile time.

See Relocating Packages

Thanks for taking a look Kevin, i will investigate the shadow plugin option.