redhat-developer / redhat-developer/vscode-java

Run mvn springboot:run fails – conflict with LSP

Abierto
#1,117 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Maven
Lenguaje dominante
TypeScript
Estrellas
2.3k
Forks
546
Merge medio
20 h 1 min
PR fusionados (30 d)
11

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza reproduciendo el conflicto entre mvn springboot:run y la inicialización de Java LSP mientras observas los archivos generados, especialmente target/classes/schema.sql. Lee los registros de compilación de Maven y LSP para determinar cuándo ambos limpian y regeneran los mismos archivos; para darlo por terminado, sería necesario confirmar un desencadenante y documentar o implementar una forma de evitar las compilaciones simultáneas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
build-system, devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.