Skip to content

The package org.springframework.ldap.core is splitย #632

Closed

Description

@hpoettker

The package org.springframework.ldap.core is a split package as it contains (different) classes in the artifacts spring-ldap-core and spring-ldap-ldif-core, respectively.

Starting with the commit d752db8, the Automatic-Module-Name is set in the produced jars. And the jars that have been released with 2.4.0-M2 have it set. But I'm afraid, the classes LdapAttribute and LdapAttributes need to be moved either to the core module or to a different package to allow spring-ldap-ldif-core to be used in a modularized application. Users have the possibility to e.g. repackage the two jars into one in their builds, but it would be great if that were not necessary.

I've built a trivial reproducer: https://github.com/hpoettker/modular-spring-ldap

It's the Gradle init app with a module-info.java that uses org.springframework.ldap.core.LdapAttribute from spring-ldap-ldif-core just to say Hello. If the transitive dependency to spring-ldap-core is excluded, this works fine. Otherwise, the app won't compile and the Gradle compile task logs:

error: the unnamed module reads package org.springframework.ldap.core from both spring.ldap.core and spring.ldap.ldif.core
error: module spring.tx reads package org.springframework.ldap.core from both spring.ldap.ldif.core and spring.ldap.core
error: module spring.beans reads package org.springframework.ldap.core from both spring.ldap.ldif.core and spring.ldap.core
error: module spring.core reads package org.springframework.ldap.core from both spring.ldap.ldif.core and spring.ldap.core
error: module spring.jcl reads package org.springframework.ldap.core from both spring.ldap.ldif.core and spring.ldap.core
error: module spring.ldap.core reads package org.springframework.ldap.core from both spring.ldap.ldif.core and spring.ldap.core
error: module spring.ldap.ldif.core reads package org.springframework.ldap.core from both spring.ldap.core and spring.ldap.ldif.core
/home/hpoettker/modular-spring-ldap/app/src/main/java/module-info.java:1: error: module com.github.hpoettker reads package org.springframework.ldap.core from both spring.ldap.ldif.core and spring.ldap.core

The reproducer uses Java 17 and Gradle 7.4.

Activity

  1. hpoettker commented on Apr 6, 2022

    @hpoettker
    Author

    Just for completeness: I stumbled on this problem not while actually trying to build a modular application.

    I was rather trying to build javadocs from a Maven build for a project that has itself the Automatic-Module-Name set. I was then hit by this: https://issues.apache.org/jira/browse/MJAVADOC-707

    One could argue that this is more a problem of the plugin than of Spring LDAP. On the other hand, there is in my opinion real value in adhering to the conventions of the Java ecosystem to leverage all available tools. And by now, these conventions seems to actually include the requirements of JPMS.

  2. self-assigned this
    on May 5, 2022
  3. added this to the 2.4.0 milestone on May 5, 2022
  4. added a commit that references this issue on May 5, 2022
    08ff8c0
  5. jzheaux commented on May 5, 2022

    @jzheaux
    Collaborator

    Thanks for the report, @hpoettker. Because ldif-core is dependent on core, it seems fine to move them into core. I prefer moving them to changing the package since a package change would need to wait for the 3.x line.

  6. added a commit that references this issue on May 5, 2022
    9ab6c49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions