Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indirect dependency wrongly scoped as test-only #1662

Open
pcdavid opened this issue Jan 31, 2024 · 0 comments
Open

Indirect dependency wrongly scoped as test-only #1662

pcdavid opened this issue Jan 31, 2024 · 0 comments

Comments

@pcdavid
Copy link

pcdavid commented Jan 31, 2024

Steps to reproduce:

  1. Install Eclipse IDE for Enterprise Java and Web Developers 2023-12 and start it on a fresh workspace.
  2. (Optional) Update m2e to the latest snapshot from https://download.eclipse.org/technology/m2e/snapshots/latest/ ("M2E Maven Integration for Eclipse Core 2.4.200.20231119-0901 org.eclipse.m2e.feature" at the moment of this writing).
  3. Import the attached project in the workspace. Its a basic Spring Boot project created from start.spring.io with a dependency to Spring Data JPA (and thus Hibernate). It's using Spring Boot 3.0.6 and thus hibernate-core-6.1.7-Final.jar which are not the latest, but the latest versions have deprecated a type used in my reproduction case (though I don't think this is relevant here).
  4. The project does not compile because the ModeEnumType it defines has an indirect dependency to org.jboss.logging.Logger which is not in the main build path:

The type org.jboss.logging.Logger cannot be resolved. It is indirectly referenced from required type org.hibernate.type.EnumType

In the project's "Maven Dependencies", jboss-logging-3.0.5-final.jar is there, but marked as test-only:

image

image

In the project's POM, uncomment the dependency:

<dependency>
  <groupId>org.jboss.logging</groupId>
  <artifactId>jboss-logging</artifactId>
</dependency>

Compilation is now OK.

Note that even without the explicit dependency added, the project builds without error:

% ./mvnw compile
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ demo ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Copying 0 resource from src/main/resources to target/classes
[INFO] 
[INFO] --- compiler:3.10.1:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/pcdavid/tmp/eclipse-jee-2023-12-R-linux-gtk-x86_64/eclipse/wks/demo/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.840 s
[INFO] Finished at: 2024-01-31T16:18:19+01:00
[INFO] ------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant