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

JDK14 JPMS problem - module colesico.armario.mailer reads package org.simplejavamail.internal.modules from both org.simplejavamail.core and org.simplejavamail #265

Open
colesico opened this issue May 6, 2020 · 4 comments

Comments

@colesico
Copy link

colesico commented May 6, 2020

Hi, here is my pom part:

<dependency>
            <groupId>org.simplejavamail</groupId>
            <artifactId>simple-java-mail</artifactId>
            <version>6.0.4</version>
</dependency>

module-info:

requires org.simplejavamail;
requires org.simplejavamail.core;

and app code:

 Email email = EmailBuilder.startingBlank()
            .from(mailerJob.getFromName(), mailerJob.getFromAddr())
            .to(mailerJob.getToAddr())
            .withSubject(mailerJob.getSubject())
            .withPlainText(mailerJob.getText())
            .buildEmail();

when try to compile application an error occurred:

module 'bla bla' reads package org.simplejavamail.internal.modules from both org.simplejavamail.core and org.simplejavamail

If remove (1) 'requires org.simplejavamail.core;' or (2) 'requires org.simplejavamail;' from module-info another error occuring:

for (1): package org.simplejavamail.api.email is not visible
for (2) package org.simplejavamail.mailer is not visible

It seams something wrong with the package exporting in simplejavamail jpms modules

@bbottema
Copy link
Owner

Yikes, I don't have much experience with modules in Java, so right now your guess is as good as mine (probably better :P)

@keiki85
Copy link

keiki85 commented May 19, 2020

Hi. I have encountered the same issue when I expiremented with modules.

The problem imo is described here:
https://stackoverflow.com/questions/42358084/package-conflicts-with-automatic-modules-in-java-9

From my understanding is the issue that both jars provide the same packages.

Yet I'm also new to the module topic and was just expirementing with it on a private play around project.

@colesico
Copy link
Author

To make good jpms support in my opinion it is need to do the following:

  1. Eliminate package duplication in a modules
  2. Add to all modules src/main/java/module-info.java (JMPS module declaration file )
  3. Export all public packages from each module ("exports [package name]" declaration in module-info)
  4. For module "simple-java-mail" add "requires transitive core-module" declaration to module-info to avoid exporting both modules in client code

@zetti12345
Copy link

zetti12345 commented Nov 24, 2021

Is there a plan to provide simple-java-mail JPMS conform?

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

No branches or pull requests

4 participants