Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] POM derived

Once a project is mavenized, the Eclipse configuration is aligned to Maven's (pom.xml is the truth) so as to minimize impedance mismatch between the two.
Since the maven-compiler-plugin only processes java files from src/[main|test]/java, Eclipse is configured to do the same. Hence the included **/*.java attribute. 
Resource folders of Maven projects in eclipse generally have an excluded="**" pattern, as resources are processed by the maven-resources-plugin, not JDT (see [1]). In your case, the resource folders are not identified properly (it could be a case where java and resource files are mixed), so in doubt, the included="**/*.java" pattern is set to let JDT process all java files only [2], maven-resources-plugin taking care of the rest.

This settings are non-modifiable.

As for 'Update project' remembering previous settings, you can open an enhancement request to https://bugs.eclipse.org/bugs/enter_bug.cgi?product=m2e. Quality patches are welcome[3]


[1] http://wiki.eclipse.org/M2E_FAQ#Why_resource_folders_in_Java_project_have_excluded.3D.22.2A.22
[2] https://github.com/eclipse/m2e-core/blob/18efa30c0781afe093157fd0a22fb49d3e4643ec/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java#L422
[3] http://wiki.eclipse.org/M2E_Development_Environment#Submitting_patches

Fred


On Wed, Jan 22, 2014 at 9:39 AM, Manfred Schurhoff <Manfred.Schurhoff@xxxxxxx> wrote:
Hi,

When I import an existing project into Eclipse Kepler SR1 and then convert it to a Maven Project, the m2e plugin updates the .classpath files based on 'project information from the pom.xml'.
The source and resources folders get updated with Includes and Excludes, for example:

For an EJB project:
ejbProject/ejbModule used to have Included: (All) and Excluded: (None), but becomes Included: **/*.java
ejbProject/src/main/java used to have Included: (All) and Excluded: (None) and remains the same after the update project.
ejbProject/src/main/resources used to have Included: (All) and Excluded: (None) and becomes Included: **/*.java (whereas resources should actually be including other files than java sources)
ejbProject/src/test/java used to have Included: (All) and Excluded: (None) and becomes Included: **/*.java

For a JAR project:
jarProject/src/main/java used to have Included: (All) and Excluded: (None) and remains the same after the update project.
jarProject/src/main/resources used to have Included: (All) and Excluded: (None) and becomes Included: **/*.java (whereas resources should actually be including other files than java sources)
jarProject/src/test/java used to have Included: (All) and Excluded: (None) and becomes Included: **/*.java
jarProject/src/test/resources used to have Included: (All) and Excluded: (None) and becomes Included: **/*.java (whereas resources should actually be including other files than java sources)

For a WAR project:
warProject/src/main/java used to have Included: (All) and Excluded: (None) and remains the same after the update project.
warProject/src/main/resources used to have Included: (All) and Excluded: (None) and becomes Included: **/*.java (whereas resources should actually be including other files than java sources)
warProject/src/test/java used to have Included: (All) and Excluded: (None) and becomes Included: **/*.java
warProject/src/test/resources used to have Included: (All) and Excluded: (None) and becomes Included: **/*.java (whereas resources should actually be including other files than java sources)

We are using a company wide parent pom which contains most of the configuration for our projects, like maven-ear-plugin, maven-jar-plugin, maven-war-plugin, maven-ejb-plugin. All project poms inherit from this company wide parent pom, so they mainly only have to be concerned with including the correct dependencies in their poms.
What is triggering the change of these classpath settings when you update your maven project in Eclipse? Could it be that we need to change some configuration in the company wide parent pom to get things right (such that it doesn't add the **/*.java includes)?

Preferably, I don't want the classpath settings to be changed when I convert a project to Maven. How can I prevent this on initial conversion or import?
I also noticed that there is an option under Maven > Update Project where you can turn off 'Update project configuration from pom.xml'. Once disabled, it will leave the .classpath files unchanged. But I have to turn off this option each time I do an 'Update project' manually. Is there a way to have this option turned off by default?

Regards,

Manfred



---------------------------------------------------------------------------------------------------------------
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure.
If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system. 
If you are not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.

Please consider the environmental impact before printing this document and its attachment(s).
Print black and white and double-sided where possible.

----------------------------------------------------------------------------------


_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-dev




--
"Have you tried turning it off and on again" - The IT Crowd

Back to the top