redhat-developer / redhat-developer/vscode-java
Run mvn springboot:run fails – conflict with LSP
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
I have a maven java project and sometimes (not always) when I perform a maven build on my project ( the maven build also generates some files..) , the build fails because a conflict with the maven build that the lsp performes. ( The lsp maven build first clean some files and then regenerate them again).
It happens because the initialization of the Java LSP (which triggers a maven call) and the maven call to start the application conflict with each other.
It's basically two build processes running on the same file set at the same time (and it appears both with the clean option). This can lead to unexpected results in case one build process deletes files the other build process just created and requires in a next step.
In the logs here for example , you can see the same issue ( a file "schema.sql" that is missing):
An exception occurred while running. null: InvocationTargetException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat: Error creating bean with name 'cdsODataV4Servlet' defined in class path resource [com/sap/cds/framework/spring/config/CdsODataV4ServletConfig.class]: Unsatisfied dependency expressed through method 'cdsODataV4Servlet' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cdsRuntime' defined in class path resource [com/sap/cds/framework/spring/config/CdsRuntimeConfig.class]: Unsatisfied dependency expressed through method 'cdsRuntime' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'transactionManagerFactory' defined in class path resource [com/sap/cds/framework/spring/config/TransactionConfig.class]: Unsatisfied dependency expressed through method 'transactionManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$DataSourceTransactionManagerConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker': Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.UncategorizedScriptException: Failed to execute database script from resource [URL [file:/home/user/projects/products-service/srv/target/classes/schema.sql]]; nested exception is java.lang.IllegalArgumentException: 'script' must not be null or empty -> [Help 1]
- Can you tell me when the LSP triggers the maven build ? is it on specific actions ? or for example every x seconds ?
- Do you know how can I solve this issue ? ( maybe by configuring something ?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the conflict between mvn springboot:run and Java LSP initialization while watching the generated files, especially target/classes/schema.sql. Read the Maven and LSP build logs to determine when both clean and regenerate the same files; done would require a confirmed trigger and a documented or implemented way to prevent the concurrent builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100