Repository navigation
Description
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
hpoettker commentedon Apr 6, 2022
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-Nameset. I was then hit by this: https://issues.apache.org/jira/browse/MJAVADOC-707One 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.
Consolidate org.springframework.security.core package
jzheaux commentedon May 5, 2022
Thanks for the report, @hpoettker. Because
ldif-coreis dependent oncore, it seems fine to move them intocore. I prefer moving them to changing the package since a package change would need to wait for the 3.x line.Consolidate org.springframework.security.core package