Managing Gradle plugin with Maven

I know that this might seem unusual, but can you manage a Gradle plugin project with Maven? Basically, I implemented a Gradle plugin for an existing framework which currently uses Maven builds, and the initial build.gradle I created should be translated to pom.xml. I’m asking this because I can’t seem to find equivalent for compile gradleApi(), which includes local libraries as dependencies (absent in Maven Central).

Does anyone had a similar problem and can provide a minimal pom.xml example?

Perhaps you could invoke gradle from maven via the gradle-maven-plugin

I think it would be better to fully migrate the build to Maven, as the project itself doesn’t invoke or require any specific Gradle tasks. (Unless Gradle does something with the jar other than validation when it detects defined Gradle plugins in resources.) A simple mvn install would be enough, which basically matches gradle build install or gradle uploadArchives, AFAIK.

At this time not all of the Gradle API JARs are published to a public Maven repository. This might change in the future though. As a result you won’t be able to declare the Gradle API dependencies in a Maven build.

You can find a similar discussion in this post.

I agree with @Lance_Java here. Just delegate from your Maven build to Gradle. The Gradle build script for your plugin will be short and simple to understand thanks to the gradleApi() notation.

Seems that currently there’s no other choice. I was pretty sure it comes down to missing Gradle API jars, but that’s not the case after all. Anyway, thanks for your help.

FYI you may do this in conjunction with build-helper:attach-artifact so that the artifact is ‘known’ to maven (for install / deploy etc)