-
Notifications
You must be signed in to change notification settings - Fork 442
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
Preventing .classpath overwrite #285
Comments
It seems Buildship always overwrites .classpath files on Gradle project import. @donat is there any way (API) to prevent that? |
@abarisain have you tried getting gradle to generate a customized eclipse .classpath? See https://docs.gradle.org/4.1/dsl/org.gradle.plugins.ide.eclipse.model.EclipseClasspath.html |
Hello, thanks for the fast answer! I've tried to use a Gradle plugin that generates a classpath by reading the Android project, but it fails on some of my projects. I did not think of using the plugin you've linked. I'll give it a shot, thanks! |
Please comment your findings here, that might help other people |
For now, I can't seem to get this to work. The eclipse plugin throws a null pointer when defining a "file" section, and does not recognize any of the configurations. I also tried a gradle android plugin, which throws an NPE Note that I'm running the beta Android tools, which work really differently than the old ones. I'm not surprised that it breaks. I'll try removing write permissions on .classpath. It should work around my problem for the time being. Thanks for the support! |
@fbricon Sorry for the late response, I was away for a few weeks. Buildship always overrides the classpath when a project is refreshed. However, the content of the classpath file can be customized in the |
I tried adding a eclipse.classpath.file section again, and this time the NPE is gone. I'm not sure what happened back then. Anyway, I'll override everything I need in the classpath in the gradle file. While I still think that it would be handy to force vscode-java to use the .classpath I provide and ignore Gradle, this solution works for me! Anybody who really wants to prevent .classpath to be overwritten can also use their native OS' features to do so. It worked for me. I believe this issue can be closed. |
I was experiencing an issue similar to this and I managed to work around the problem. I had used Spring to generate a basic Rest API app and it created both Maven and Gradle constructs. I am partial to Maven so I updated pom.xml to add some dependencies. Everything seemed fine but, not sure what happened, without warning my local classpath-based compiles stopped working. The dependencies I had added to the classpath had disappeared. In fact the classpath no longer had any Maven references at all, just Gradle. "mvn, clean package" worked at all times. I searched extensively and could not find a reason this would have occurred. I finally found these two settings for Red Hat Developer and set them as follows in my workspace settings.
Made an innocuous change to the pom.xml file, saved it, and the build returned to normal. It would appear that the two features are replacing the classpath. |
Hello,
While I'm fully aware that Android projects are unsupported, manually crafting .classpath files provide quite satisfying results - with the caveat that they don't support env vars, so you have to hardcode the path to your Android SDK.
For example, with a classpath that looks like:
I'm able, after indexing, to get completion for my project's classes, but also Android's.
Libraries need a little more work, but I don't mind doing everything manually, as both the platform version and libraries don't change often.
The problem is that vscode-java notices that this is a gradle project, and will overwrite.
I have to rewrite the .classpath with my version every time I reopen vscode.
I'd like to have a setting to tell the plugin never to overwrite .classpath on its own.
Environment
Steps To Reproduce
Current Result
.classpath was overwritten with an empty one
Expected Result
.classpath should have not been overwritten
Additional Informations
I tried setting " "java.configuration.updateBuildConfiguration": "disabled" ", but that does not help
The text was updated successfully, but these errors were encountered: