L
L
longcat2018-11-22 14:21:00
Java
longcat, 2018-11-22 14:21:00

How to build a java library using gradle with dependencies that will be downloaded when using the library?

I have nexus, spring-boot projects, build is done by gradle.
I want to create a spring-boot-starter, upload it to nexus and connect it to arbitrary spring-boot projects.
As a dependency, the starter will have spring-web (which is in all projects)
At the same time, there are projects on spring-boot 1.5/2.0.6/2.1.0 (gradually updating)
How can I build and publish a starter in nexus so that it dependencies were not hardcoded, but at least by enumeration or range or default version, and so that when you connect it to the project, gradle itself pulls in its dependencies if they are not there (or, perhaps, crashes with an error if the versions are not suitable)?
As I understand it, I need to create a pom.xml file (which seems to be created when publishing with the maven-publish plugin)
gradle generatePomFileForPubNamePublication task can generate pom.xml and put it somewhere
Somehow you need to specify possible dependencies
But I don’t understand how to put it all together.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2018-12-21
@alfss

nexus Proxy Repository should solve the problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question