Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] please test m2e 1.1 M6 candidate build

I just confirmed this is caused by WTP.

If you create a simple, generic Eclipse Project, no folders are created. Now do Configure > Convert to Maven (use jar packaging), a pom will be created. The project is turned into a java project and references the src/main/java and src/test/java folders in its classpath but they're missing at this point. Now if you right-click on the project, Properties > Project Facets > Convert to Faceted form > Check Utility project, then the missing classpath folders will be created.

The WTP facets are automatically added to projects in m2e-wtp (any jar project dependency of a JavaEE project requires the Utility facet -WTP requirement, not mine).

So, not m2e's fault. You can blame m2e-wtp if you want but it's really caused by WTP creating these folders when adding facets.

Fred Bricon


On Fri, Mar 23, 2012 at 10:01 AM, <thorsten.heit@xxxxxx> wrote:
Hi Igor,

> m2e deliberately creates "forward" references to all source/resource
> folders found in pom.xml in .classpath. These are marked as optional, so
> jdt builder silently ignores folders that do not actually exist on
> filesystem. This behaviour is consistent with maven command line build,
> which, too, will check these folders for sources/resources, but will
> silently ignore them if they do not exist.
>
> m2e does not create the folders on filesystem and I don't know who does it.


I have seen this behaviour a couple of times, and I can confirm and repeat the recreation of folders such as src/test that don't exist on a project of mine. The problem seems to be that in my case the Eclipse project descriptor files such as .project and .classpath are checked in in our CVS system:

Assume that I have a slightly older version 2.0.1 of the project in my workspace. The files are checked out from CVS by using the tag that was created by "mvn release:prepare release:perform".

The .project contains two buildCommand and two nature entries:

<buildSpec>
        <buildCommand>
                <name>org.eclipse.jdt.core.javabuilder</name>
                <arguments>
                </arguments>
        </buildCommand>
        <buildCommand>
                <name>org.eclipse.m2e.core.maven2Builder</name>
                <arguments>
                </arguments>
        </buildCommand>
</buildSpec>
<natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>


The .classpath file is quite simple:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry kind="src" output="target/classes" path="src/main/java"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
        <classpathentry kind="output" path="target/classes"/>
</classpath>

Both files were created with m2e 1.0 as far as I can remember. So far, so good. Clicking on "Maven -> Update Project..." doesn't change anything; there's only src/main/java as the only source folder.


Now, since m2e 1.1.x the checked-in head revision of the .classpath file (created with m2e 1.1.x and clicking on "Maven -> Update Project...") looks different:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry kind="src" output="target/classes" path="src/main/java">
                <attributes>
                        <attribute name="optional" value="true"/>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="src" output="target/test-classes" path="src/test/java">
                <attributes>
                        <attribute name="optional" value="true"/>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                        <attribute name="org.eclipse.jst.component.nondependency" value=""/>
                </attributes>
        </classpathentry>
        <classpathentry kind="output" path="target/classes"/>
</classpath>

Switching from the tagged version to the HEAD revision lets Eclipse/m2e/whatever magically create the non-existing folders src/test and src/test/java, perhaps because they're mentioned in the .classpath file.

But: This happens only when I switch from the sticky revision that uses a simpler version of the .classpath file to a newer one that uses the above classpath entries, but not when I let m2e update the project, even when I'm using the head revision.


Regards

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




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

Back to the top