[ https://issues.apache.org/jira/browse/MCOMPILER-337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Scholte closed MCOMPILER-337. ------------------------------------ Resolution: Not A Problem Assignee: Robert Scholte > Using old-style Jar files with Java9 Module project, Classpath and > Module-path are mixed up! > -------------------------------------------------------------------------------------------- > > Key: MCOMPILER-337 > URL: https://issues.apache.org/jira/browse/MCOMPILER-337 > Project: Maven Compiler Plugin > Issue Type: Bug > Affects Versions: 3.7.0 > Reporter: Colbert Philippe > Assignee: Robert Scholte > Priority: Major > Attachments: quebec.lachine.zip > > > I'm trying to use Eclipse (4.8M4) with Maven to practice Java9 module. > I already contacted Maven to ask what version of Maven to use with Java 9 > module feature. They recommended the latest version: Maven 3.5.0 (latest) > with the Maven plug-in: maven-compiler-plugin 3.7.0, which is what I'm using. > I'm also using Java JDK 9. > I want to report a problem with Maven when working with Java 9 module > feature. It's not a big problem but it's big enough to prevent the use of > Maven with Java 9 modules. The problem is with Maven, when used under > Eclipse. I create Maven projects under Eclipse for speed. > I created two identical projects with Java 9 module. The two projects make > use of a few old-style Jar files by importing them as default module (as > prescribed by the makers of Java 9). The jar files are: ant.jar, > commons-beanutils-1.9.3.jar, commons-collections4-4.1.jar, > commons-lang3-3.7.jar. > * The first project is a small project built from the command-line with a > text-editor. It's a Java 9 module project (has a module-info.java) and makes > use of these 4 libray jar files in the manner prescribed by the Java 9 > documentation. This project compiles and works. All Jar files are put the the > module-path of the project and their respective 'requires' statement is in > the module-info.java file. (see below) > > {code:java} > module canada.ontario { > exports canada.ontario; > requires org.apache.commons.lang3; > requires commons.collections4; > requires commons.beanutils; > } > {code} > * > ** The second project is identical to the first one but is built using Maven > (versions specified above) created under Eclipse. The project as created as > intended based on Maven guidelines. First a parent project was created with > packaging set with pom. The a child-project was created for the module. > After the child-project was created, in the child-project POM file, I entered > the full plug-in entries to use the new 'maven-compiler-plugin' version > 3.7.0. This works because we can see its use on the compiling log display > messages. > On Eclipse Workspace view, I selected the parent project root (previously > created), right clicking on the parent project, then selecting 'Maven', then > selecting 'New Maven Module Project'. This creates a Maven child project for > the new module. > - I created a 'module-info.java' with the name of the module > (canada.ontario) in the src directory. > - I also created a package with the same name as the module (canada.ontario). > - I entered the same 'exports' and 'requires' statements as displayed above. > - I also entered all the Maven dependencies to each of the four (4) > libraries stated above. I got these dependencies from the Maven repository. > - I also enabled full compile-time log-message diplay, in order to get > maximum information. > HERE IS THE PROBLEM WHEN COMPILING THIS SECOND MAVEN CHILD-PROJECT! > When compiling the second child-project for the module, there is an error. I > have narrowed down the reason for the error. > For some unknown reason, the Maven compiler plug-in DOES NOT put all the jar > dependencies under the module-path. It splits the list of dependencies > between the classpath and the module-path, WHICH IS WRONG! (see below) > {noformat} > [INFO] Changes detected - recompiling the module! > [DEBUG] Classpath: <----- There should be no jar under this Classpath list > *** > [DEBUG] C:\Users\Colbert > Philippe\workspace\montreal\quebec.lachine\target\classes > [DEBUG] C:\Users\Colbert > Philippe\.m2\repository\org\apache\commons\commons-collections4\4.1\commons-collections4-4.1.jar > [DEBUG] C:\Users\Colbert > Philippe\.m2\repository\commons-beanutils\commons-beanutils\1.9.3\commons-beanutils-1.9.3.jar > [DEBUG] C:\Users\Colbert > Philippe\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar > [DEBUG] C:\Users\Colbert > Philippe\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar > [DEBUG] Modulepath: <----- All jar file dependencies should be under this > ModulePath list *** > [DEBUG] C:\Users\Colbert > Philippe\.m2\repository\org\apache\commons\commons-lang3\3.7\commons-lang3-3.7.jar > [DEBUG] Source roots: > {noformat} > This is the source of the error! > Since putting all the jar files under module-path works in my first > hand-created project works fine. I am certain that this is the cause of the > error. > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)