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

Bug: package org.simplejavamail.internal.modules causes split package problem in Java9+ #378

Closed
quimodotcom opened this issue Jan 20, 2022 · 9 comments

Comments

@quimodotcom
Copy link

quimo@Evans-Air sendemailaction % mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.stream-pi:sendemailaction >--------------------
[INFO] Building sendemailaction 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ sendemailaction ---
[INFO] Deleting /Users/quimo/Documents/GitHub/essential-actions/sendemailaction/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sendemailaction ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/quimo/Documents/GitHub/essential-actions/sendemailaction/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ sendemailaction ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/quimo/Documents/GitHub/essential-actions/sendemailaction/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] the unnamed module reads package org.simplejavamail.internal.modules from both org.simplejavamail.core and org.simplejavamail
[ERROR] module org.simplejavamail.core reads package org.simplejavamail.internal.modules from both org.simplejavamail and org.simplejavamail.core
[ERROR] module org.simplejavamail reads package org.simplejavamail.internal.modules from both org.simplejavamail.core and org.simplejavamail
[ERROR] /Users/quimo/Documents/GitHub/essential-actions/sendemailaction/src/main/java/module-info.java:[1,1] module com.quimodotcom.sendemailaction reads package org.simplejavamail.internal.modules from both org.simplejavamail and org.simplejavamail.core
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.316 s
[INFO] Finished at: 2022-01-20T11:14:49Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sendemailaction: Compilation failure: Compilation failure:
[ERROR] the unnamed module reads package org.simplejavamail.internal.modules from both org.simplejavamail.core and org.simplejavamail
[ERROR] module org.simplejavamail.core reads package org.simplejavamail.internal.modules from both org.simplejavamail and org.simplejavamail.core
[ERROR] module org.simplejavamail reads package org.simplejavamail.internal.modules from both org.simplejavamail.core and org.simplejavamail
[ERROR] /Users/quimo/Documents/GitHub/essential-actions/sendemailaction/src/main/java/module-info.java:[1,1] module com.quimodotcom.sendemailaction reads package org.simplejavamail.internal.modules from both org.simplejavamail and org.simplejavamail.core
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@bbottema
Copy link
Owner

What is the situation, context and how do I fix this?

@quimodotcom
Copy link
Author

What is the situation, context and how do I fix this?

situation is said in the code and the title, context is in the code. idk how to fix it that's why I'm asking you.

@bbottema
Copy link
Owner

You're not giving me much to go on here, friend. What version of maven and Simple Java Mail are you on. What dependencies do you have if you do mvn dependency:tree what JDK are you using, what Simple Java Mail modules have you included etc., Windows, Linux.

I suspect you are using JDK 11 or above, but I don't know much about modules. There have been issues about this before, which are still open, but frankly I don't get many bug reports about this so I'm not sure.

@quimodotcom
Copy link
Author

apache version: Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /usr/local/Cellar/maven/3.8.4/libexec
Java version: 17, vendor: Oracle Corporation, runtime: /Users/quimo/jdk-17.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "12.1", arch: "x86_64", family: "Mac"

SimpleJavaMail: 7.0.0

man dependency:tree: quimo@Evans-MacBook-Air sendemailaction % mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.stream-pi:sendemailaction >--------------------
[INFO] Building sendemailaction 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ sendemailaction ---
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO] com.stream-pi:sendemailaction:jar:1.0.0
[INFO] +- com.stream-pi:action-api:jar:1.0.0-SNAPSHOT:compile
[INFO] | +- com.stream-pi:util:jar:1.0.0-SNAPSHOT:compile
[INFO] | | +- org.openjfx:javafx-controls:jar:17.0.0.1:compile
[INFO] | | | +- org.openjfx:javafx-controls:jar:mac:17.0.0.1:compile
[INFO] | | | - org.openjfx:javafx-graphics:jar:17.0.0.1:compile
[INFO] | | | +- org.openjfx:javafx-graphics:jar:mac:17.0.0.1:compile
[INFO] | | | - org.openjfx:javafx-base:jar:17.0.0.1:compile
[INFO] | | | - org.openjfx:javafx-base:jar:mac:17.0.0.1:compile
[INFO] | | +- org.kordamp.ikonli:ikonli-javafx:jar:12.2.0:compile
[INFO] | | | - org.kordamp.ikonli:ikonli-core:jar:12.2.0:compile
[INFO] | | +- org.kordamp.ikonli:ikonli-fontawesome5-pack:jar:12.2.0:compile
[INFO] | | - com.google.code.gson:gson:jar:2.8.8:compile
[INFO] | - eu.hansolo:Medusa:jar:11.7:compile
[INFO] - org.simplejavamail:simple-java-mail:jar:7.0.0:compile
[INFO] +- org.simplejavamail:core-module:jar:7.0.0:compile
[INFO] | +- com.sun.mail:jakarta.mail:jar:2.0.1:compile
[INFO] | +- com.sun.activation:jakarta.activation:jar:2.0.1:compile
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] | | - jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- com.sanctionco.jmail:jmail:jar:1.2.1:compile
[INFO] | - com.github.tony19:named-regexp:jar:0.2.6:compile
[INFO] +- com.github.bbottema:jetbrains-runtime-annotations:jar:1.0.1:compile
[INFO] - org.slf4j:slf4j-api:jar:1.7.32:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.527 s
[INFO] Finished at: 2022-01-20T15:23:34Z
[INFO] ------------------------------------------------------------------------

@bbottema
Copy link
Owner

So I just did a mvn clean package with SJM 7.0.0 and Oracle JDK 17 and I'm not able to reproduce this. Can you share your code with me?

@quimodotcom
Copy link
Author

sendemailaction.zip

@bbottema bbottema changed the title the unnamed module reads package org.simplejavamail.internal.modules from both org.simplejavamail.core and org.simplejavamail Bug: package org.simplejavamail.internal.modules causes split package problem in Java9+ Jan 25, 2022
@bbottema bbottema added this to the 7.0.2 milestone Jan 25, 2022
@bbottema
Copy link
Owner

I finally get it, it's the split package problem caused by the same package occurring in multiple modules.

bbottema added a commit that referenced this issue Jan 25, 2022
@bbottema
Copy link
Owner

Thank you for the example, that was very helpful. I released a fix in 7.0.2.

@quimodotcom
Copy link
Author

Thank you for the example, that was very helpful. I released a fix in 7.0.2.

absolute legend!

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

2 participants