0
votes

I am building a Spring Boot web application and in my setup I have a local repository that hosts all my thirdparty JARs - the repository is ivy format. I have been able to build the WAR file whilst connecting to Maven Central repository, and I now need to be able to build offline from my local repository.

I have copied all the dependencies required into the ivy format (/{module}/{name}/{version}/{name}-{version}.jar) and I now want to turn off the mavenCentral() repository and just build locally.

However, if i run gradle dependencies I am not seeing any of the transitive dependencies listed as I do when I am connected to maven central. In my local repo I have also added the appropriate .pom file (following same naming convention as the JAR file) and also tried adding the ivy.xml files but still no sign of the transitive dependencies.

Can anyone point me in the right direction or suggest what I am doing wrong here?

An example of one of my Spring-Boot JARs in my local repo:

$ ls /repo/org.springframework.boot/spring-boot-starter-web/1.1.8.RELEASE
spring-boot-starter-web-1.1.8.RELEASE.jar  spring-boot-starter-web-1.1.8.RELEASE.pom

My build file configuring the local ivy repo:

repositories {
    ivy   { url "file://repo" }
}

Sample of running gradle dependencies:

+--- org.springframework.boot:spring-boot-starter-web: -> 1.1.8.RELEASE
+--- org.springframework.boot:spring-boot-starter-security: -> 1.1.8.RELEASE
+--- org.springframework.boot:spring-boot-starter-thymeleaf: -> 1.1.8.RELEASE
+--- org.springframework:spring-context-support: -> 4.0.7.RELEASE
1
If you're not getting transitive dependencies then it probably can't find the metadata descriptor (ivy.xml). You may have to specify a custom layout. Check here for details. You can also try running Gradle with the --info or --debug command line options to get more details about the dependency resolution process which might help you troubleshoot.Mark Vieira
Thanks @MarkVieira will take a look - do you know where the default location for the ivy.xml file would be in an ivy repository? and is the expected name ivy.xml, or the same as the JAR/pom name pattern but .xml?rhinds
Thanks @MarkVieira I read through that link, and that gave me the answer I needed - I had tried my ivy.xml as the same pattern as the JAR and as just plain ivy.xml - but from the link I see that it needs to be ivy-{version}.xml - That change has made some dependencies show up! If you want to add it as an answer I will accept thatrhinds

1 Answers

1
votes

If you're not getting transitive dependencies then it probably can't find the metadata descriptor (ivy.xml). You may have to specify a custom layout. Check here for details.