Cyclic dependencies during multi-module compilation

Zheka Kozlov orionllmain at gmail.com
Tue May 8 10:11:43 UTC 2018


Are you sure that you have a cycle between modules? You state that
"monitor.statistics depends on monitor.persistence", however I do not see
this in module-info.java:

module monitor.statistics {
requires monitor.observer;
exports monitor.statistics;
}


2018-05-08 16:34 GMT+07:00 Nicolai Parlog <nipa at codefx.org>:

>  Hi Zheka,
>
> this branch demonstrates what I describe:
>
>         https://github.com/CodeFX-org/demo-jpms-monitor/tree/break-
> cyclic-dependency-compile-time
>
> Run `multi-compile.sh && run.sh` and you will see the compiler happily
> creating the modules whereas the runtime complains about the cyclic
> dependency. Maybe I'm doing something weird without noticing? (I tried
> it on 9.0.1, 9.0.4, 10, and 11-ea+7.)
>
>  so long ... Nicolai
>
>
>
> On 08.05.2018 11:05, Zheka Kozlov wrote:
> > Hi Nicolai.
> >
> > I cannot reproduce what you said. I'm using JDK 10.0.1. I created two
> > modules moduleA and moduleB which require each other. When I tried to
> > compile, javac failed with an error: cyclic dependence involving module.
> >
> > Do you observer a different behavior?
> >
> > 2018-05-08 15:01 GMT+07:00 Nicolai Parlog <nipa at codefx.org>:
> >
> >>  Hi!
> >>
> >> In early access builds, multi-module compilation would fail if there was
> >> a dependency cycle between the involved modules. I just realized that
> >> that is no longer the case in 9.0.1 and later (up to Java 11).
> >>
> >> I'm interested to learn the background for that decision? I considered
> >> that check A Good Thing - why was it removed?
> >>
> >>  so long ... Nicolai
> >>
> >>
> >>
> >> --
> >>
> >> PGP Key:
> >>     http://keys.gnupg.net/pks/lookup?op=vindex&search=
> 0xCA3BAD2E9CCCD509
> >>
> >> Web:
> >>     http://codefx.org
> >>         a blog about software development
> >>     https://www.sitepoint.com/java
> >>         high-quality Java/JVM content
> >>     http://do-foss.de
> >>         Free and Open Source Software for the City of Dortmund
> >>
> >> Twitter:
> >>     https://twitter.com/nipafx
> >>
> >
>
> --
>
> PGP Key:
>     http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509
>
> Web:
>     http://codefx.org
>         a blog about software development
>     https://www.sitepoint.com/java
>         high-quality Java/JVM content
>     http://do-foss.de
>         Free and Open Source Software for the City of Dortmund
>
> Twitter:
>     https://twitter.com/nipafx
>


More information about the jigsaw-dev mailing list