VSC always change .classpath file of each bundle

Hi,

I developing openhab with Visual Studio Code, but have two anoying things on that:

first thing at each bundle .classpath-file there are file changes always when opening VSC

there are following lines added by Visual Studio Code:

<classpathentry kind="src" path="target/generated-sources/annotations">
	<attributes>
		<attribute name="optional" value="true"/>
		<attribute name="maven.pomderived" value="true"/>
		<attribute name="ignore_optional_problems" value="true"/>
		<attribute name="m2e-apt" value="true"/>
	</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
	<attributes>
		<attribute name="optional" value="true"/>
		<attribute name="maven.pomderived" value="true"/>
		<attribute name="ignore_optional_problems" value="true"/>
		<attribute name="m2e-apt" value="true"/>
		<attribute name="test" value="true"/>
	</attributes>
</classpathentry>

And second on openhab-core it adds a .factorypath file to each bundle I open.

This make it’s really hard on commits not to commit files I don’t want to be changed

Has anyone a solution please what I’m doing wrong?

Thanks

DerOetzi

Only open the folder that your bundle is installed on (don’t open the high level folder of all bundles) and add factorypath to gitignore.

I uninstalled the java extension.

Four years later, and I find myself in the same situation with .classpath and .project files.

I’m wondering why this is different between the repos, core and addons:

$ find -name .classpath | wc -l
124
$ find -name .classpath | wc -l
0

First question: Is there a good reason for the different approaches?

If yes, next question: How can I make Visual Studio Code generate these files correctly, so I:

  • Don’t see tons of differences (causing problems when switching branches etc.)
  • Can commit the files with proper contents when doing PR’s.

The .project files are having additional contents generated such as:

	<filteredResources>
		<filter>
			<id>1712773949828</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>

And the .classpath files like described by @DerOetzi in the OP.

Same issue here.

One solution is to remove all the .classpath files and add it to .gitignore, but not sure if that causes side effects. Not sure if this difference between core and addons is on purpose.

Have you found a different solution? I keep removing the changes, but it is error prone and meh.

IIRC the Core projects did not import correctly automatically in Eclipse so that’s why they weren’t removed. Maybe someone can check if that is still an issue.

.classpath are also updated when importing one core project in Eclipse.