Skip to content

Commit c732b9c

Browse files
Add runtimeOnly and latest.release usage examples
1 parent f06b15a commit c732b9c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,22 @@ For example:
7878
implementation("software.amazon.nio.s3:aws-java-nio-spi-for-s3:2.3.0")
7979
```
8080

81+
> [!TIP]
82+
> If your application only uses standard Java NIO APIs and doesn't directly reference S3-specific classes,
83+
> you can use `runtimeOnly` instead of `implementation`. This allows the S3 provider to be discovered
84+
> automatically via Java's ServiceLoader mechanism:
85+
> ```groovy
86+
> runtimeOnly("software.amazon.nio.s3:aws-java-nio-spi-for-s3:2.3.0")
87+
> ```
88+
> This approach is cleaner as it keeps the S3 provider as a pure runtime dependency that's loaded dynamically.
89+
>
90+
> You can also use `latest.release` to automatically get the most recent stable version:
91+
> ```groovy
92+
> runtimeOnly("software.amazon.nio.s3:aws-java-nio-spi-for-s3:latest.release")
93+
> ```
94+
> **Note**: Using `latest.release` can lead to unexpected behavior if new versions introduce breaking changes.
95+
> Specifying exact versions is recommended for reproducible builds.
96+
8197
The library heavily relies on the `crt` client from aws. It uses the [`uber`
8298
version](https://github.com/awslabs/aws-crt-java?tab=readme-ov-file#platform-specific-jars) for simplicity
8399
and wide range of supported platforms.

0 commit comments

Comments
 (0)