1

I am working on a project which pulls in artifacts from nexus as dependencies using gradle. I am not trying to test the changes I am making in a dependency, and would like to test it. Rather than deploy it to nexus, and bump the version before I know it works, I would like to build in a way that I normally would in maven using :

mvn clean intall

Is there a way to do this with gradle? I can't find exactly what I am looking for, essentially I want to build my snapshot, and be able to import it in my project instead of pulling down the version on nexus.

I know someone is going to tell me to google this - but maybe I have been using the wrong search term - I can't find exactly what I am looking for at all with regard to this.

MickeyThreeSheds
  • 986
  • 4
  • 23
  • 42

1 Answers1

3

You can use the maven plugin:

apply plugin: "maven"

and the use the gradle install task.

Otherwise you can use the maven-publish plugin:

apply plugin: 'maven-publish'

and then the publishToMavenLocal task. More info here.

These tasks build the project and then publish into the local Maven repo.

Make sure to add mavenLocal() to get the dependencies in your project.

repositories {
    mavenLocal()
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841