"Error:java: option --add-exports not allowed with target 1.8" or Per module compiler settings

Answered

We have huge project with hundreds of modules with dependencies between them.

Some of the module are Java 1.6/1.8 most of the 1.9 jigsaw.

So we are trying to add jigsaw specific compiler setting, like '--add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED'

And as expected got error message 'Error:java: invalid flag: --add-exports', so I turned off 

No I get (again as expected) and error message ''Error:java: option --add-exports not allowed with target 1.8"

So now I in dead end,

What we really need is something like the settings for 'annotation processor' which there I can group the modules and give each module different settings

 

3
5 comments

I tired to add these settings to 'But is has no effect.

 

Boaz

 

0

Bug report is welcome at https://youtrack.jetbrains.com/issues/IDEA. We can't suggest a workaround at the moment. Jigsaw/modules support is not complete yet.

0

@Roman Even if I can compile all with JDK 9 some of them must be compiled with lower target. It works till JDK 8 in with the compiler ignore -parameters option when source target is less than 8, but now with JDK 9 they close this hole and if you compile with target 8 then new 9 flags are not recognized.

It is not jigsaw issue, it is missing feature , but now with jigsaw it becomes a stopper. Indeed I will fill Jira request

2

Whoa, I wasn't aware that Javac disallows these options for `--target 8`, thanks.Yep, we'll do something about this.

Sure, we'll fix this - one way or another.

0

Please sign in to leave a comment.