2

We are making use of Zulu JDK 11 and we are facing issue The package com.sample.test is accessible from more than one module: test1.module, test2.sample.

Below is the git url for sample project and screenshot for your reference.

https://github.com/kkvaranasi88/test1.git

vss
  • 1,093
  • 1
  • 20
  • 33
Kiran
  • 167
  • 2
  • 15

1 Answers1

0

A simple solution is to rename the package in your second module tes-2 to say com.sample.another.test and then update your module description to

module test2.sample {
    exports com.sample.another.test;
    requires transitive test1.module;
}

and things shall work fine.

Having said that, the cause for failure is that no two modules should export the same package such that they are both resolved in the module layer as s conflict.

Naman
  • 27,789
  • 26
  • 218
  • 353
  • 1
    This will work with user defined packages. But what about framework ones. Suppose if I am working on application on struts 2 and I am making use of struts2-core.jar, struts2-junit-pulugin.jar which shares the common package name org.apache.struts2. Please find theStruts2Example in the git url https://github.com/kkvaranasi88/Test which doesn't work on JDK11 or even from JDK 9 onwards. Even I have opened the jira https://issues.apache.org/jira/browse/WW-5032?filter=-8 – Kiran May 29 '19 at 06:20