0

Java 8, Spring Boot 1.5.8 and Gradle 4.6 here.

I'm building a Spring Boot app and use the built-in Gradle tasks to produce a self-contained, executable "fat" jar for it. Another team has generated a dependency JAR that I need to incorporate into my project.

In a few months we will have a binary repository set up that they will publish new versions of their library to, and that I will resolve/pull from. But for right now, I'm stuck with the somewhat draconian distribution model where they email me a version and I need to figure out how to get it working with Gradle to get it on the classpath.

So...

My project lives on my machine at /home/myuser/workspace/my-spring-boot-app. They have emailed me the first version of their library, say, some-lib-0.1.0.jar and I have downloaded it to, say, /home/myuser/some-lib-0.1.0.jar).

Another complicating (and important!) factor is that this JAR has no pom.xml file with it (yet). They simply included, in their email, a list of all its dependencies which I have already included in my app's build.gradle file. So I don't think this JAR's dependencies will be a problem, but wanted you all to be aware that there is no pom.xml for it, so not sure if that means I need to write my own, etc...

I'm imagining that the simplest solution here is to install/import the library into my local Maven/Gradle repository (wherever mavenLocal() resolves from)? And that once its imported/installed there, I can just add mavenLocal() to my list of repositories { ... } and add it as a compile dependency, right?

If so, how do I accomplish the first part (getting it into mavenLocal() without a POM)? And if not, what is the simplest solution here? Thanks in advance!

hotmeatballsoup
  • 385
  • 6
  • 58
  • 136
  • 1
    did you try this : https://stackoverflow.com/questions/20700053/how-to-add-local-jar-file-dependency-to-build-gradle-file ? – Logan Wlv Feb 22 '19 at 14:29

1 Answers1

1

Call the Maven goal install:install-file (i.e. mvn install:install-file on the command line)

https://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html

and you set generatePom to true. So something like

mvn install:install-file -DgeneratePom=true -DartifactId=somelib -DgroupId=com.somecompany -Dversion=0.1.0
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142