Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Classpathentry to .classpath vanishes for every build in Maven java project #2058

Closed
KameshwarB opened this issue Aug 12, 2021 · 3 comments

Comments

@KameshwarB
Copy link

Added Classpathentry to .classpath vanishes for every build in Maven java project

Hello there,
My project uses mustache templates to get the list of the POJO classes and add to target/generated-sources, during each build the classpathentry added is deleted automatically and only the set of classpath entries which is by default added.
whatever the entries that was added to the project classpath should be there. but, entries vanishes after each build, i do build by both integrated terminal as well as git bash, both cases remain the same.
Note: this is can't be replicated at first time , but with multiple retires it is replicated.

Environment
  • Operating System: Windows 10
  • JDK version: open JDK 11
  • Visual Studio Code version: 1.59.0 latest
  • Java extension version: Language Support for Java(TM) by Red Hat v0.80.0
Steps To Reproduce
  1. add a class path entry in .classpathfile like below
		<classpathentry kind="src" path="target/generated-sources/swagger/src/main/java">
			<attributes>
				<attribute name="optional" value="true"/>
				<attribute name="maven.pomderived" value="true"/>
			</attributes>
		</classpathentry>
		<classpathentry kind="src" path="project-app/target/generated-sources/swagger/src/main/java">
			<attributes>
				<attribute name="optional" value="true" />
				<attribute name="maven.pomderived" value="true" />
			</attributes>
		</classpathentry>
  1. then try to build your project with mvn clean install
    Additional information
    please use a maven project to check this and build your app each time and multiple time.
@rgrunber
Copy link
Member

Could you use https://www.mojohaus.org/build-helper-maven-plugin/usage.html to configure additional source directories in your pom file ? I tried adding that goal to a Maven project, and it seemed to persist the sources into the .classpath.

Generally, the .classpath file is not meant to be touched since the language server is responsible for its contents.

@snjeza is there another way to do this ?

@snjeza
Copy link
Contributor

snjeza commented Aug 12, 2021

is there another way to do this ?

You may want to take a look at #177

@KameshwarB
Copy link
Author

thanks for quick response @snjeza and @rgrunber , this resolves my issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants