eclipse-m2e / m2e-core

Eclipse Public License 2.0
110 stars 109 forks source link

How to avoid .project changes by m2e (needed for PDE Maven integration) #1785

Open vogella opened 2 weeks ago

vogella commented 2 weeks ago

If I open eclipse.platform projects frequently the .project files are getting modified, similar to the following:

<buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.pde.PluginNature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
    <filteredResources>
        <filter>
            <id>1720167607154</id>
            <name></name>
            <type>30</type>
            <matcher>
                <id>org.eclipse.core.resources.regexFilterMatcher</id>
                <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
            </matcher>
        </filter>
    </filteredResources>

I typically reset these changes, assuming we do not want these in platform. But as this happens frequently I wonder how others like @laeubi or @HannesWell handle these? Add .project to .gitignore? Or is there a setting to avoid this?

vogella commented 2 weeks ago

Plus I get org.eclipse.m2.core.prefs generated with the following content:

activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
vogella commented 1 week ago

Example for my PDE workspace:

image

laeubi commented 1 week ago

I'm not sure hwo you setup exactly the workspace but this does not happen with the official SDK setup and should only happen if you explicitly enable m2e nature for a project.

vogella commented 1 week ago

I'm not sure hwo you setup exactly the workspace but this does not happen with the official SDK setup and should only happen if you explicitly enable m2e nature for a project.

Thank is very good to hear.

My regular process is:

So I would guess nothing special. I can test the next time these annoying file pop up.

I have also seen the generation of these files with clients. I assume most platform developer except you and @HannesWell do not have the M2E / PDE extension installed as he SDK development is not using target platform with Maven dependencies (or any target platform as far as I know, IMHO one of the reasons why the target editor was super slow and buggy for a long time) or use the Oomph setup which may also do a different setup / installation.

laeubi commented 1 week ago

The setup is described here and that contains m2e and of course the pde extension, if people are using something else that's possible but not necessarily supported so one probably seeing different results.

vogella commented 1 week ago

The setup is described here and that contains m2e and of course the pde extension, if people are using something else that's possible but not necessarily supported so one probably seeing different results.

The issue is also present for non-platform projects so I think it is good to find what is causing this.

fbricon commented 1 week ago

the filter is created by jdt.ls, which means either you opened your code in VS Code, or with some Eclipse/JDT.LS client plugin

laeubi commented 1 week ago

The issue is also present for non-platform projects so I think it is good to find what is causing this.

As said I never have seen such issue with any Eclipse I can officially download nor with the official platform setup, so I don't see what m2e (that is an Eclipse Plugin) can do here.

vogella commented 1 week ago

The issue is also present for non-platform projects so I think it is good to find what is causing this.

As said I never have seen such issue with any Eclipse I can officially download nor with the official platform setup, so I don't see what m2e (that is an Eclipse Plugin) can do here.

Like I said, once I see this again, I will try to create a reproducable example with official downloads.

vogella commented 1 week ago

the filter is created by jdt.ls, which means either you opened your code in VS Code, or with some Eclipse/JDT.LS client plugin

Thanks, that is interesting I keep that in mind during my attempt to re-create. Should jdt.ls also respect the m2e nature setting or does it consider other setting files?