How to reference local Gradle project from Maven build as dependency?

Viewed 467

I have several Gradle library projects and main Ant spring web-app project (historically). I'd like to replace Ant with Maven for main project while keeping existing Gradle projects nature.

Is it possible to refer local Gradle projects from pom.xml as local dependencies of Maven project?

Search readily gives me the opposite - "how to refer maven projects from gradle builds", but not my case.

1 Answers

Gradle always builds locally build/libs (or distributions); the only easy way to share the build dependencies between completely different projects is 'as maven repository dependencies'

in your case the options are

  1. Work Local Builds only
    add the maven plugin to the gradle builds - do local install
    and refer them in the maven build locally.

  2. Build Anywhere
    Your Gradle builds publish artefacts to your local nexus
    and you refer them properly in your dependencies

--
Gradle by default does not have 'maven install'; it can be added using the maven plugin see - https://docs.gradle.org/current/userguide/maven_plugin.html#header.

Related