1

I have 2 projects, Project A and Project B. both are gradle projects in separate git repositories. Project B uses elasticsearch-rest-api jar and is included in dependencies as follows:

dependencies {
    compile "org.elasticsearch.client:rest:5.4.0",
            "org.elasticsearch.client:sniffer:5.4.0"
}

Project A uses Project B and Project B is added as a dependency to Project A as follows:

apply plugin: 'java'
apply plugin: 'spring-boot'

dependencies {
        compile "com.example:ProjectB:1.0.0"
}

when i refresh the gradle dependencies of Project A, only Project B jar is available in the "Project and External Dependencies". I am not able to see elastic client rest and sniffer jars in Project A dependencies.

because of this, when i start the Project A spring boot application, it is throwing the below error:

ERROR o.s.b.SpringApplication [main] Application startup failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.discover.paymentservices.dnfraud.pads.txnprocessor.PadsTransactionProcessorApplication]; nested exception is java.io.FileNotFoundException: class path resource [org/elasticsearch/client/RestClient$FailureListener.class] cannot be opened because it does not exist at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:182)

As per my understanding, the Project B dependencies will also be available by default in Project A, since Project B is added as a dependency for Project A.

I tried lot of options including compile time only and providedRuntime etc. not able to figure out the issue. can anyone provide inputs on this. thanks much in advance.

Srinivas KK
  • 151
  • 3
  • 12
  • try adding `includeFlat 'Project B'` into `settings.gradle` of Project A – Bill F May 23 '17 at 05:45
  • You're not adding a dependency on project A. You're adding a dependency on the library com.example:ProjectB:1.0.0, that is published in some of your repository, and should thus have a pom.xml. What is the pom.xml of this library? – JB Nizet May 23 '17 at 05:52
  • Thanks @JBNizet and Bill F for your valuable comments. from my gradle tasks, i was running uploadArchives tasks, which was uploading artifacts to my local maven repository(.m2 folder). After seeing this comment, I ran publishToMavenLocal task and it generated the pom.xml, which has the elastic jar dependencies too. on gradle refresh of Project A, all dependencies were added including elastic. The problem is solved here. thank you. – Srinivas KK May 24 '17 at 04:04

0 Answers0