azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

[BUG] spring-cloud-azure-starter-eventhubs is pulling wrong dependencies

Open damzog opened this issue 10 months ago • 6 comments

Describe the bug Trying to compile simple example like spring-cloud-azure-starter-eventhubs with gradle. With following dependencies

dependencies {
    implementation 'com.azure.spring:spring-cloud-azure-starter'
    implementation 'com.azure.spring:spring-cloud-azure-starter-eventhubs'
    ...
}

but it does not compile, see error below. Issue might be caused by the module "Spring Cloud Azure Starter Event Hubs" (imported via above mentioned dependencies itself. In its pom.xml it defines:

...
    <dependency>
    <groupId>com.azure</groupId>
      <artifactId>azure-messaging-eventhubs</artifactId>
      <version>5.20.1</version> <!-- {x-version-update;com.azure:azure-messaging-eventhubs;dependency} -->
    </dependency>
    <dependency>
      <groupId>com.azure</groupId>
      <artifactId>azure-messaging-eventhubs-checkpointstore-blob</artifactId>
      <version>1.20.5</version> <!-- {x-version-update;com.azure:azure-messaging-eventhubs-checkpointstore-blob;dependency} -->
    </dependency>
...

where it probably should be com.azure.spring and spring-messaging-azure-eventhubs

Exception or Stack Trace

ReceiveEventsService.java:4: error: package com.azure.spring.messaging.eventhubs.implementation.core.annotation does not exist
import com.azure.spring.messaging.eventhubs.implementation.core.annotation.EventHubsListener;

To Reproduce Steps to reproduce the behavior: Checkout and try to compile

Code Snippet See spring-cloud-azure-starter-eventhubs.

Expected behavior Compiles and works

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: Ubuntu
  • IDE: Intellij
  • Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)]
  • Java version: Java 21
  • App Server/Environment: SpringBoot fat jar
  • Frameworks: SpringBoot

Additional context

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ ] Bug Description Added
  • [ ] Repro Steps Added
  • [ ] Setup information Added

damzog avatar Apr 22 '25 14:04 damzog

@moarychan @netyyyy @rujche @saragluna

github-actions[bot] avatar Apr 22 '25 14:04 github-actions[bot]

Thank you for your feedback. Tagging and routing to the team member best able to assist.

github-actions[bot] avatar Apr 22 '25 14:04 github-actions[bot]

Hi @damzog ,could you try the latest codes with Spring Cloud Azure 5.22? I compiled with 5.22 and can't reproduce

Netyyyy avatar Apr 23 '25 00:04 Netyyyy

Hi @Netyyyy , actually I checked out the whole samples repo and build the particular sample with maven and it works for me, too.

Now I tried to reproduce the issue (which actually happens with gradle) with a minimal project setup and checked it in. Could you please try to compile https://github.com/damzog/eventhubs-spring-messaging?

I still think something is wrong with the project hirarchy and pom.xml files after some refactoring.

damzog avatar Apr 25 '25 13:04 damzog

@Netyyyy I added a dependency com.azure.spring:spring-messaging-azure-eventhubs to my build.gradle and now it works, see below. I think this dependency should be implicitly pulled from com.azure.spring:spring-cloud-azure-starter-eventhubs, shouldn't it?

dependencies {
    implementation 'com.azure.spring:spring-cloud-azure-starter'
    implementation 'com.azure.spring:spring-cloud-azure-starter-eventhubs'
    implementation 'com.azure.spring:spring-messaging-azure-eventhubs'
    implementation 'com.azure:azure-messaging-eventhubs-checkpointstore-blob'
}

damzog avatar May 02 '25 10:05 damzog

Hi @Netyyyy , actually I checked out the whole samples repo and build the particular sample with maven and it works for me, too.

Now I tried to reproduce the issue (which actually happens with gradle) with a minimal project setup and checked it in. Could you please try to compile https://github.com/damzog/eventhubs-spring-messaging?

I still think something is wrong with the project hirarchy and pom.xml files after some refactoring.

Hi, @damzog I can't reproduce the issue using you provided project. Here is the screenshot:

Image

Could you please share the console output of the command gradle build in your side?

rujche avatar Jun 17 '25 02:06 rujche

@rujche Sorry it took me some time to resume. I tried to reproduce myself and now it worked. I did not find out what changed but I will close the ticket for now. Thanks for checking and supporting!

damzog avatar Jun 30 '25 07:06 damzog