[ 
https://issues.apache.org/jira/browse/MCOMPILER-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16436083#comment-16436083
 ] 

Colbert Philippe edited comment on MCOMPILER-337 at 4/12/18 6:19 PM:
---------------------------------------------------------------------

 

Hi Robert!   Robert, I used Eclipse to create the entire project structure.   I 
didn't hand-code it!   It takes too long by hand.   I prefer to do it through 
Eclipse.   My version of Eclipse is the most recent one for Java9.    It's 
Eclipse 4.8M.   There is another version: Eclipse  4.8M a for Java10.   I think 
both are very similar.

 

Here is how I created the project under Eclipse using Maven.

I create a new simple Java project using Maven.   I make sure that it's package 
is POM.   That's my parent project. Within my parent project (right-click on 
parent), go down the menu to Maven->Create New Maven Module, which creates a 
new child-project for a module. The module-info is not in the child-project (it 
should since I selected 'Create new Maven Module').   Eclipse should be doing 
this automatically.    I am forced to create my own module-info.java.   I do 
this using Eclipse menu option.     Right-click 
child-project->Configure->Create module-info I am also forced to create the 
module package myself.   Eclipse should be doing this. I populate the 
module-info.java as show my original letter.

 

 

If you wish, we can do a Skype conference and do a screen-share.   This might 
save time narrowing down the problem.

 

The bottom-line is that Maven + maven-compiler-plugin is mixing-up Classpath 
and module-path.   That's WRONG!   Only module-path should be used!

 


was (Author: cp10000):
Hi Robert!   Robert, I used Eclipse to create the entire project structure.   I 
didn't hand-code it!   It takes too long by hand.   I prefer to do it through 
Eclipse.   My version of Eclipse is the most recent one for Java9.    It's 
Eclipse 4.8M.   There is another version: Eclipse  4.8M a for Java10.   I think 
both are very similar.

Here is how I created the project under Eclipse using Maven.
 * I create a new simple Java project using Maven.   I make sure that it's 
package is POM.   That's my parent project.
 * Within my parent project (right-click on parent), go down the menu to 
Maven->Create New Maven Module, which creates a new child-project for a module.
 * The module-info is not in the child-project (it should since I selected 
'Create new Maven Module').   Eclipse should be doing this automatically.   
 * I am forced to create my own module-info.java.   I do this using Eclipse 
menu option.     Right-click child-project->Configure->Create module-info
 * I am also forced to create the module package myself.   Eclipse should be 
doing this.
 * I populate the module-info.java as show my original letter.

 

If you wish, we can do a Skype conference and do a screen-share.   This might 
save time narrowing down the problem.

The bottom-line is that Maven + maven-compiler-plugin is mixing-up Classpath 
and module-path.   That's WRONG!   Only module-path should be used!

 

 

> 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
>            Priority: Major
>
> 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)

Reply via email to