Splitting the Java 9 code into its own module and shading that back in to log4j-api seems like it could work for now. I'd imagine that as Java 9 gets released or sometime soon hopefully, the IDEs will start adding support for multi-version modules/projects.
On 22 May 2017 at 11:16, Remko Popma <remko.po...@gmail.com> wrote: > One idea: we could move (actually copy) the StackLocator interface to the > Java 9 module. > This allows us to build the Java 9 module first. Then, when building the > log4j-api module, the Java 9 classes can be shaded into the log4j-api jar > (excluding StackLocator since we want to compile that interface with Java > 7). > > That way all modules depend on Java 7 except the log4j-api-java9 module > which depends on Java 9. This is clean, works well in IDEs and does not > require the toolchain workaround. The whole project could probably be > compiled with just JDK 9 this way. > > Started to play with this but could not finish today. Need to continue > tomorrow. > > > On Tue, May 23, 2017 at 12:59 AM, Ralph Goers <ralph.go...@dslextreme.com> > wrote: > > > Java 9 now has a —release option which should help. However, if we set it > > to Java 7 I suspect the build will fail on the Java 9 stuff even though > we > > are using the Java 9 compiler. I really don’t see a way to do this except > > by calling the compiler multiple times. > > > > Ralph > > > > > On May 22, 2017, at 8:49 AM, Matt Sicker <boa...@gmail.com> wrote: > > > > > > I still want to see a better Maven plugin for handling Java 9 > > multi-release > > > jars and things like that. The whole Java 9 build is still rather > hacky. > > If > > > the entire project was buildable in Java 9 and could still target 7, 8, > > and > > > 9, then that would be a simpler solution IMO. > > > > > > On 22 May 2017 at 06:16, Mikael Ståldal <mi...@apache.org> wrote: > > > > > >> IntelliJ IDEA is "smart" enough to automatically pick up the > > >> src/main/java9 folder. > > >> > > >> > > >> > > >> On 2017-05-21 22:26, Ralph Goers wrote: > > >> > > >>> Since src/main/java9 isn’t normally considered a source directory you > > >>> should be able to work with Java 7 as well. It will just ignore the > > Java 9 > > >>> files. > > >>> > > >>> Ralph > > >>> > > >>> On May 21, 2017, at 5:50 AM, Gary Gregory <garydgreg...@gmail.com> > > wrote: > > >>>> > > >>>> I set the JRE for that project to Java 9. I do not think you can set > > the > > >>>> JRE per source folder, only per project. > > >>>> > > >>>> Gary > > >>>> > > >>>> On May 21, 2017 1:29 AM, "Ralph Goers" <ralph.go...@dslextreme.com> > > >>>> wrote: > > >>>> > > >>>> I’ve modified the build to put the Java 9 classes of the API into a > > >>>> separate source directory. Can you see if that helps things in > > Eclipse? > > >>>> > > >>>> Ralph > > >>>> > > >>> > > >>> > > >> > > > > > > > > > -- > > > Matt Sicker <boa...@gmail.com> > > > > > > > -- Matt Sicker <boa...@gmail.com>