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
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users

Reply via email to