redhat-developer / redhat-developer/vscode-java

Run mvn springboot:run fails – conflict with LSP

Ouverte
#1,117 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Maven
Langage dominant
TypeScript
Étoiles
2.3k
Forks
546
Merge moyen
20 h 1 min
PR mergées (30 j)
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]

  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 ?)

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire le conflit entre mvn springboot:run et l'initialisation de Java LSP tout en observant les fichiers générés, en particulier target/classes/schema.sql. Consultez les journaux de build de Maven et de LSP pour déterminer quand les deux nettoient et régénèrent les mêmes fichiers ; la tâche ne serait considérée comme terminée qu'avec un déclencheur confirmé et un moyen documenté ou implémenté d'empêcher les builds concurrents.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
build-system, devtools
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.