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

Java9 modules, fix overlapping package names #666

Closed
pethers opened this issue Apr 26, 2018 · 5 comments
Closed

Java9 modules, fix overlapping package names #666

pethers opened this issue Apr 26, 2018 · 5 comments
Labels

Comments

@pethers
Copy link
Contributor

@pethers pethers commented Apr 26, 2018

Overlapping package names in different jar files, cause issues when using module-info.java in java9.

Workaround https://github.com/Hack23/cia/blob/master/service.data.impl/javers-all/pom.xml to bundle all alls jar into 1, but not nice.

Modular jar:s with Automatic-Module-Name set would be prefered.

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Apr 27, 2018

Hi, I have tested javers on java10 but without modulepath. Never tested with modules. Would you like to contribute a PR with modules support to javers? We dont want the single jar. Im not sure if automatic module names are the best solution. maybe we can create regular module names and hide most of the public classes inside modules?

@pethers
Copy link
Contributor Author

@pethers pethers commented Apr 27, 2018

Main problem is that https://github.com/javers/javers/tree/master/javers-spring-jpa/src/main/java/org/javers/spring/auditable/aspect/springdata and https://github.com/javers/javers/tree/master/javers-spring/src/main/java/org/javers/spring/auditable/aspect/springdata is using the same package name.

Renaming javers-spring-jpa/src/main/java/org/javers/spring/auditable/aspect/springdata to javers-spring-jpa/src/main/java/org/javers/spring/auditable/aspect/springdatajpa, will solve the package name conflict and should be a minimal change. Happy to create a pull request for this if wanted ?

Example with automatic module name for javers-spring-data, without any change to jar automatic module name is based on the file name. So by default this would be javers.spring.data.

By adding manifest entries in jar plugin, you can set it to anything you want.

<Automatic-Module-Name>org.javers.spring.data</Automatic-Module-Name>

This do not require any changes to jdk compile time version.

Another solution, is to add module-info.java to all modules, but requires multiple jdk toolchain if support for JDK7 -> JDK9 is required. So probably overkill.

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Apr 28, 2018

If the packege renaming will do the job, let's do it. Seems like the this class https://github.com/javers/javers/tree/master/javers-spring-jpa/src/main/java/org/javers/spring/auditable/aspect/springdata is not used by users so renaming is safe. Please contribute a PR. Thanks.

@pethers
Copy link
Contributor Author

@pethers pethers commented Apr 29, 2018

Created #668 , but maybe better option to move JaversSpringDataJpaAuditableRepositoryAspect to javers-spring module. Would not break compatibility and not need package -> protected modifier changes.

bartoszwalacik added a commit that referenced this issue Apr 30, 2018
#666 refactor package name
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented May 1, 2018

released in 3.7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants