redhat-developer / redhat-developer/vscode-java

Run mvn springboot:run fails – conflict with LSP

Aperta
#1,117 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Maven
Lingua principale
TypeScript
Stelle
2.3k
Fork
546
Merge medio
20h 1m
PR unite (30g)
11

Descrizione

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]

  1. Can you tell me when the LSP triggers the maven build ? is it on specific actions ? or for example every x seconds ?
  2. Do you know how can I solve this issue ? ( maybe by configuring something ?)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il conflitto tra mvn springboot:run e l'inizializzazione di Java LSP mentre osservi i file generati, in particolare target/classes/schema.sql. Leggi i log di build di Maven e LSP per determinare quando entrambi puliscono e rigenerano gli stessi file; il lavoro sarebbe completo solo con un trigger confermato e un modo documentato o implementato per impedire le build simultanee.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
build-system, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.