M
M
Maxim2016-10-12 19:09:48
Java
Maxim, 2016-10-12 19:09:48

How to use gradle module as a library in other modules?

I'm migrating a project to a microservice architecture and ran into a code reuse issue.
I have 4 services, and all of them should be able to communicate with each other, for this I am going to write a module that I would like to use as a library in these services.
How to do it?
I understand that you can raise an artifactory and publish your module there, but I would like a simpler solution because this is my personal project.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mitaichik, 2016-10-13
@z17

In settings.gradle you should describe where your library is located:
rootProject.name = 'api'
include ':requester'
project(':requester').projectDir = new File(settingsDir, '../requester')
Here api is the main module, requester - library.
In build.gradle, you need to specify it as a dependency:
dependencies {
compile project(':requester')
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question