When Java 9 module system integrate into Maven, how to handle automatic module

Viewed 2345

I have already practiced java 9 module system integration with Maven project. and it seems to work well but I was anxious about backward compatibility of maven module compiled before java 9.

For backward compatibility, JPMS(Java Platform Module System) has Automatic Module Concept. In JPMS, Jar file without module-info.java is regarded as Automatic Module and other java module can use this jar file by using its file name as module name.

In case of integration with maven project, I think additional support for JPMS backward compatibility needed. first, basic jar file and maven jar file is not same structure. second, maven jar file naming is incompatible with rule can be compatibility with JPMS module naming rule. see the below example.

<artifactId>previous-version-module</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

In above cases, We already uses previous-version-module-0.0.1-SNAPSHOT and want to use this module in new java 9 maven project.

module new.module{
  requires previous-version-module-0.0.1-SNAPSHOT
}

but it occur compile error or IDEA tool throw error.

I'm wondering how to use maven jar file which compiled before java 9 in java 9 and maven integration project. I searched some additional module definition rule or maven plugin, I can't find any solution.

Thanks.

1 Answers
Related