Building jar targeting multiple Java versions, including 9

Uwe Schindler uschindler at
Fri Aug 26 11:48:31 UTC 2016


I know it is a bit of strange request. Maybe this could also be a solution: How about implementing a Maven plugin that generates a module-info.class file out of box using ASM 6.0 without any source code - just by configuration? Or maybe use the ANTLR syntax and write e very simple separate compiler? Or alternatively: Could the compiler be separated from javac, so it can be executed as a separate tool, maybe shipped as a separate JAR file like the JRT filesystem?

Another thing that we could allow is to execute Javac with older source/release/target setting, but add an extra flag to allow it compiling without complaining?


Uwe Schindler
uschindler at 
ASF Member, Apache Lucene PMC / Committer
Bremen, Germany

> -----Original Message-----
> From: jigsaw-dev [mailto:jigsaw-dev-bounces at] On Behalf
> Of Alan Bateman
> Sent: Friday, August 26, 2016 1:32 PM
> To: Robert Scholte <rfscholte at>; jigsaw-dev at
> Subject: Re: Building jar targeting multiple Java versions, including 9
> On 26/08/2016 11:49, Robert Scholte wrote:
> > Hi,
> >
> > I'm struggling with this issue too.
> > I would have liked to see all the files under src/main/java, but since
> > module-info cannot be compiled at the same time as the other files we
> > need to do some extra things:
> >
> > Possible solutions:
> > - Keep them all in the same folder but let Maven do 2 javac
> > executions, auto-selecting the right files. I don't like this kind of
> > magic and when the configuration of the maven-compiler-plugin becomes
> > complex, there's a chance the magic is doing it wrong.
> > - Introduce an extra sourcefolder. This is by far the most clean
> > solution and with good documentation we should be able to explain this.
> > I've created MCOMPILER-275[1] to implement this new feature.
> The intention is that the be in the root directory and
> I could imagine it confusing developers if they have to edit it in a
> separate source tree. I also worry that it would give the impression
> that a separate source tree is the right way to structure the source
> code. I'm also not sure how it would work in the IDE. Then we have the
> issue that the src and output tree no longer matching, that could be
> confusing too. Then we have the question of projects targeting >= JDK 9
> where I assume you would have the in the root directory.
> How difficult would it be for the compiler plugin to special case
> when compiling for an older release? Would there be
> something in the POM to indicate whether the project produces a module,
> as a modular JAR?
> -Alan.

More information about the jigsaw-dev mailing list