Is building via Maven/Gradle with depedency fetch from MavenCentral currently supported?

I am part of a small team working on creating GTK bindings for Kotlin/Native. We want to provide a project template that integrates Meson, the preferred build system for GTK projects, with Gradle, the build system used by Kotlin/Native. Our objective is to merge the two systems by calling Gradle from Meson, much like what has been done for Rust and Meson + Cargo.

However, we are unsure if we can currently fetch artifacts from MavenCentral, as this would require an internet connection during the Gradle build phase. We are wondering how this issue is handled with Cargo. For instance, is it possible to fetch crates from when building an application for Flathub? If so, would it be possible to do the same for Gradle and MavenCentral?

If the answer is no, are there any known workarounds? Additionally, we are curious if there are any Java/Kotlin apps with dependencies on MavenCentral available on Flathub so that we can have a look at how they solved the issue.

Build have to be done offline. Either you vendor the packages in the tarball, our you generate a manifest to download the dependencies, like it is done for rust/cargo, go, python, npm, etc.

I see, thank you for the answer. Are there already some Java/Kotlin app doing this? Is there maybe some script to generate this dependencies manifest similar to the one available for python?

There are two submission in the flatpak-builder-tools for both maven and gradle

But they haven’t been merged yet.