I want to create a multi-release JAR file for a library. I will build the MRJAR using maven - and initially it will contain Java 8 and Java 9 class files.
BUT - I do not want to maintain two separate sets of source code (eg in src/main/java-8
and src/main/java-9
). Is it possible to have all of the Java-9 files in eg src/main/java
and only the ones which differ in eg src/main/java-8
?
Ideally, the full source code would then be organized as:
+ pom.xml
+ src
+ main
+ java
<full java-9 source code>
+ java-8
<overriding .java files which can only be compiled with java-8>
I do not want to maintain two separate sets of source code
You have to, so you can compile the Java 8 files separately from the Java 9 files.
Implied in the question (the way I read it), but not explicitly stated, is that you have two copies of the files that don't differ . You certainly don't need that.
Is it possible to have all of the Java-9 files in eg src/main/java and only the ones which differ in eg src/main/java-8?
That wouldn't make any sense, because all the files that don't differ must be Java 8 files, not Java 9 files.
Do the opposite.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.