Could we have --exclude-modules option?

Andrejus Chaliapinas andrejusc at yahoo.com
Tue Aug 9 21:23:09 UTC 2022


> Are these two JARs built from code you control?

No, they are all Open Source

> If not, then trying to
> figure out if your application "works" when only JAR1 is present, or
> only JAR2 is present, sounds difficult.  

It's actually not difficult - set of tests runs over and checks runtime behaviour. And passing extra argument to either Surefire for UTs or Failsafe for ITs/etc. plugins configs is trivial. 

> And introducing
> --exclude-modules to "fight" the dependencies resolved by Maven is a bad
> idea. 

I see this option as extra flexibility for complex projects. It's not about "fight" here, but about fast way of figuring out what is actually needed/suitable and allowing gradual migrations. Cause dealing with Maven exclusions in POMs (even if that is final goal to fully eliminate conflicts) is more difficult till some extent. 

One side use case here is presence of jars with key word in their names (like "byte" or "native"), which are invalid from Java modules angle, but quite often are yet Automatic as not migrated to support Java modules. So then workaround is either injecting extra Manifest entry by some Maven plugin or renaming overall jar. Both activities are less trivial comparing to proposed option.

Andrejus



On Tuesday, August 9, 2022, 10:03:56 PM GMT+1, Alex Buckley <alex.buckley at oracle.com> wrote: 





On 8/9/2022 1:07 PM, Andrejus Chaliapinas wrote:
> > Have you tried java --validate-modules? This option will scan the 
> module path split package for other issues so that you get a dump of all 
> issues.
> 
> Yes, that was my starting point, i.e usage of --validate-modules. But 
> seeing outcome of it for complex dependencies set led to this my 
> proposal actually. Cause validate shows conflicts, but elimination of 
> them takes effort via build tooling configs. And much easier would be 
> initially to evaluate runtime outcome via flexible exclusion capability 
> (i.e. in a way we have for Maven dependencies exclusions for example).

Are these two JARs built from code you control? If not, then trying to 
figure out if your application "works" when only JAR1 is present, or 
only JAR2 is present, sounds difficult. And introducing 
--exclude-modules to "fight" the dependencies resolved by Maven is a bad 
idea.

Alex


More information about the jigsaw-dev mailing list