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

LCLS locks openliberty.properties preventing mvn clean when server.xml open in editor #216

Closed
scottkurz opened this issue Oct 4, 2023 · 3 comments · Fixed by #217
Closed
Assignees
Labels
bug Something isn't working

Comments

@scottkurz
Copy link
Member

So I wanted to at least raise this for awareness...not sure what can easily be done...

But if I have my server.xml file open in Liberty Tools Eclipse and need to do a clean mvn clean (FWIW, Liberty Tools Eclipse doesn't offer a clean function but that's kind of besides the point here), it sometimes fails because the file is locked.

I assume this is locked by the LCLS lemminx ext:

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ batch-bonuspayout-application ---
[INFO] Deleting C:\git\sample.batch.bonuspayout\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.240 s
[INFO] Finished at: 2023-10-04T14:46:28-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project batch-bonuspayout-application: Failed to clean project: Failed to delete C:\git\sample.batch.bonuspayout\target\liberty\wlp\lib\versions\openliberty.properties -> [Help 1]

And...the workaround is just to try again until it works, which is a pretty obvious a thing to try as well. so not a huge deal. Just noting.

@cherylking
Copy link
Member

@scottkurz LCLS does read that file, but we don't "lock" it. I see things like this all the time on Windows though. When our tests run for the plugins, we see failures on clean because some Liberty file cannot be deleted. Not sure there is anything we can do about it.

@cherylking
Copy link
Member

Found a potential spot of code to change. The properties are read in the constructor in io.openliberty.tools.langserver.lemminx.data.LibertyRuntime(Path). The FileInputStream is not closed in the constructor. Should use a try-with-resources statement when processing the properties file instead.

@cherylking cherylking self-assigned this Oct 4, 2023
@cherylking cherylking added the bug Something isn't working label Oct 4, 2023
@scottkurz
Copy link
Member Author

Yeah I know saying LCLS "locks" it is oversimplifying and not entirely accurate. I just tried it again and I failed repeatedly and had to open a different editor (besides the server.xml one) to get the clean to work. OK, nice to know we have something to look at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 23.0.12
Development

Successfully merging a pull request may close this issue.

2 participants