Maven failing to clean project: Failed to delete file.
I have been facing an issue for a long time with the following command:
mvn clean install -PautoInstallSinglePackage
Sometimes it runs and just works. Other times it fails with this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on project aem-mysite-project.ui.apps: Failed to clean project: Failed to delete C:\git\MySite\ui.apps\target\generated-sources\htl\org\apache\sling\scripting\sightly\apps\mysite\components\tabs\tabs__002e__html.java -> [Help 1]
The failure is seemingly random. It happens on various files, but it happens daily. I've been trying to chase this down, and I've been able to identify via an app called LockHunter.exe that the "Language Support for Java" plugin for VSCode by Red Hat is the culprit.
Does anyone have a solution for this? Are there alternative plugins for VSCode that can be used to easily work with AEM/Java projects from VSCode? Maybe a command I can pass to maven to get it to unlock?