# Extending AbstractCopyTask for S3 / cloud object storage

**URL:** <https://discuss.gradle.org/t/extending-abstractcopytask-for-s3-cloud-object-storage/50487>\
**Category:** Help/Discuss\
**Created:** [February 12, 2025, 3:01pm UTC](https://discuss.gradle.org/t/extending-abstractcopytask-for-s3-cloud-object-storage/50487 "2025-02-12T15:01:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fidothe](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/fidothe/32/10828_2.png) [@fidothe](https://discuss.gradle.org/u/fidothe)\
**Post date:** [February 12, 2025, 3:01pm UTC](https://discuss.gradle.org/t/extending-abstractcopytask-for-s3-cloud-object-storage/50487/1 "2025-02-12T15:01:48Z")

</div>

I need to copy some task outputs to an S3 bucket, and I can’t find any obvious first-party ways of doing it. The third-party plugins I’ve found all seem to be require explicit setting of file name and object key, rather than an approach more like the `AbstractCopyTask`-based tasks like `Jar` or `Zip` (or `Copy`…).

I’ve looked for examples on how I might implement a task that extends `AbstractCopyTask` and implements whatever bits need implementing to upload objects rather than, say, creating a `.zip`, and I haven’t found anything useful.

Can anyone here recommend a starting point for understanding how to do this?

Thanks!

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [February 12, 2025, 5:30pm UTC](https://discuss.gradle.org/t/extending-abstractcopytask-for-s3-cloud-object-storage/50487/2 "2025-02-12T17:30:12Z")

</div>

If you want to do it "like `Jar`, `Zip`, or `Copy`, why not looking at them for inspiration? 🙂

---

<div class="post-metadata">

**Author:** ![fidothe](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/fidothe/32/10828_2.png) [@fidothe](https://discuss.gradle.org/u/fidothe)\
**Post date:** [February 12, 2025, 9:56pm UTC](https://discuss.gradle.org/t/extending-abstractcopytask-for-s3-cloud-object-storage/50487/3 "2025-02-12T21:56:39Z")

</div>

Because I can’t follow the rats nest of indirection, or figure out which of the interface methods are important for what I want to do, which is why I’m looking for examples…

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [February 12, 2025, 10:46pm UTC](https://discuss.gradle.org/t/extending-abstractcopytask-for-s3-cloud-object-storage/50487/4 "2025-02-12T22:46:46Z")

</div>

I had a quick look at `Copy`, seems quite easy to follow imho. 🙂

```kotlin
abstract class CustomCopy : AbstractCopyTask() {
    override fun createCopyAction() = CopyAction {
        it.process {
            println("Uploading ${it.file} to AWS")
        }
        WorkResults.didWork(true)
    }
}

val foo by tasks.registering(CustomCopy::class) {
    from(configurations.testRuntimeClasspath)
}

```

=\>

```plaintext
> Task :foo
Uploading ~\.gradle\caches\modules-2\files-2.1\org.spockframework\spock-core\2.3-groovy-4.0\8861b2590bb8e4709b052fb4ed6da3de98e734d9\spock-core-2.3-groovy-4.0.jar to AWS
Uploading ~\.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-engine\1.9.0\bd46891f01817b5ffdd368cb0482a34746610acb\junit-platform-engine-1.9.0.jar to AWS
Uploading ~\.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-commons\1.9.0\b727889107fc28c7460b21d1083212f8ce7602c6\junit-platform-commons-1.9.0.jar to AWS
Uploading ~\.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-launcher\1.9.0\367a24bb63baca99a181ea921da8e21af0656e7c\junit-platform-launcher-1.9.0.jar to AWS
Uploading ~\.gradle\caches\modules-2\files-2.1\org.apache.groovy\groovy\4.0.4\1199db7007c16a37dd5fdba3163b86f290460a\groovy-4.0.4.jar to AWS
Uploading ~\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest\2.2\1820c0968dba3a11a1b30669bb1f01978a91dedc\hamcrest-2.2.jar to AWS
Uploading ~\.gradle\caches\modules-2\files-2.1\org.opentest4j\opentest4j\1.2.0\28c11eb91f9b6d8e200631d46e20a7f407f2a046\opentest4j-1.2.0.jar to AWS

```

The main problem I see is, that `CopyAction`, `CopyActionProcessingStream`, `CopyActionProcessingStreamAction`, and `FileCopyDetailsInternal` are internal classes.
