Nom1fan
Nom1fan

Reputation: 857

Creating common between gradle and maven

I have two projects. One is a Gradle project (Android app actually) and the other is a Maven project (A spring mvc HTTP Server based on TomCat).

These two projects have some objects that they share (The response object for example).

I would like to create a common project that will hold all the objects that the Gradle and Maven projects need.

What have I tried?

Well, I know building a project in Maven will add its artifacts to .m2 local repository, which can at least be shared by 2 Maven local projects. But I don't know as much about Gradle and how to share artifacts with it.

I would appreciate any advice you can give me to point me in the right direction.

Thanks in advance.

Upvotes: 0

Views: 47

Answers (1)

maciekjanusz
maciekjanusz

Reputation: 4775

You can import artifacts from maven repositories to Gradle projects without any problem, for example this artifact from maven central:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-io</artifactId>
    <version>1.3.2</version>
</dependency>

Can be included in your grade project as well:

dependencies {
    compile 'org.apache.commons:commons-io:1.3.2'
}

Follow this link to see different build system import formats for the above example library.

Here it is explained how to add your local maven repository to the resolution path.

So, by utilizing any maven repository (local or remote) you can deploy and include the same artifact in any of your projects and modules, maven and gradle - based.

Upvotes: 0

Related Questions