microsoft / microsoft/vscode-java-dependency

vscode-java-dependency / Java project manager is unable to detect Spring Boot project generated via vscode-spring-initializr or quarkus

Abierto
#830 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
TypeScript
Estrellas
199
Forks
105
Merge medio
1 d 22 h
PR fusionados (30 d)
27

Descripción

Java project manager is unable to detect Spring Boot project generated via vscode-spring-initializr or quarkus.

STR:

  1. open command palette
  2. Java: Create Java Project
  3. Spring Boot
  4. Gradle project
  5. 3.2.5
  6. Java
  7. dk.ndlarsen
  8. todo-api
  9. jar
  10. 21
  11. select Spring Boot DevTools
  12. select Spring Web
  13. press Enter to continue
  14. pick location -> create folder named todo-api -> pick generate into this folder
  15. OK to open project
  16. observe Java project not detected in Java Project Manager
    Screenshot from 2024-04-21 19-22-46
$ basename "$PWD"
todo-api
$ tree -a
.
├── todo-api
│   ├── build
│   │   ├── classes
│   │   │   └── java
│   │   │       └── main
│   │   │           └── dk
│   │   │               └── ndlarsen
│   │   │                   └── todoapi
│   │   │                       └── TodoApiApplication.class
│   │   ├── generated
│   │   │   └── sources
│   │   │       ├── annotationProcessor
│   │   │       │   └── java
│   │   │       │       └── main
│   │   │       └── headers
│   │   │           └── java
│   │   │               └── main
│   │   ├── resolvedMainClassName
│   │   ├── resources
│   │   │   └── main
│   │   │       ├── application.properties
│   │   │       ├── static
│   │   │       └── templates
│   │   └── tmp
│   │       └── compileJava
│   │           └── previous-compilation-data.bin
│   ├── build.gradle
│   ├── .gitignore
│   ├── .gradle
│   │   ├── 8.7
│   │   │   ├── checksums
│   │   │   │   └── checksums.lock
│   │   │   ├── dependencies-accessors
│   │   │   │   └── gc.properties
│   │   │   ├── executionHistory
│   │   │   │   ├── executionHistory.bin
│   │   │   │   └── executionHistory.lock
│   │   │   ├── expanded
│   │   │   ├── fileChanges
│   │   │   │   └── last-build.bin
│   │   │   ├── fileHashes
│   │   │   │   ├── fileHashes.bin
│   │   │   │   ├── fileHashes.lock
│   │   │   │   └── resourceHashesCache.bin
│   │   │   ├── gc.properties
│   │   │   └── vcsMetadata
│   │   ├── buildOutputCleanup
│   │   │   ├── buildOutputCleanup.lock
│   │   │   ├── cache.properties
│   │   │   └── outputFiles.bin
│   │   ├── file-system.probe
│   │   └── vcs-1
│   │       └── gc.properties
│   ├── gradle
│   │   └── wrapper
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── HELP.md
│   ├── settings.gradle
│   ├── src
│   │   ├── main
│   │   │   ├── java
│   │   │   │   └── dk
│   │   │   │       └── ndlarsen
│   │   │   │           └── todoapi
│   │   │   │               └── TodoApiApplication.java
│   │   │   └── resources
│   │   │       ├── application.properties
│   │   │       ├── static
│   │   │       └── templates
│   │   └── test
│   │       └── java
│   │           └── dk
│   │               └── ndlarsen
│   │                   └── todoapi
│   │                       └── TodoApiApplicationTests.java
│   └── .vscode
├── todo-api.old
│   ├── build
│   │   ├── bootScripts
│   │   │   ├── test-java-todo
│   │   │   └── test-java-todo.bat
│   │   ├── classes
│   │   │   └── java
│   │   │       ├── main
│   │   │       │   └── dk
│   │   │       │       └── ndlarsen
│   │   │       │           ├── App.class
│   │   │       │           └── todo
│   │   │       │               ├── GenericStorage.class
│   │   │       │               ├── InMemoryStorage.class
│   │   │       │               ├── Todo.class
│   │   │       │               └── TodoController.class
│   │   │       └── test
│   │   ├── distributions
│   │   │   ├── test-java-todo-0.0.1-SNAPSHOT.tar
│   │   │   ├── test-java-todo-0.0.1-SNAPSHOT.zip
│   │   │   ├── test-java-todo-boot-0.0.1-SNAPSHOT.tar
│   │   │   └── test-java-todo-boot-0.0.1-SNAPSHOT.zip
│   │   ├── generated
│   │   │   └── sources
│   │   │       ├── annotationProcessor
│   │   │       │   └── java
│   │   │       │       ├── main
│   │   │       │       └── test
│   │   │       └── headers
│   │   │           └── java
│   │   │               ├── main
│   │   │               └── test
│   │   ├── libs
│   │   │   ├── test-java-todo-0.0.1-SNAPSHOT.jar
│   │   │   └── test-java-todo-0.0.1-SNAPSHOT-plain.jar
│   │   ├── resolvedMainClassName
│   │   ├── scripts
│   │   │   ├── test-java-todo
│   │   │   └── test-java-todo.bat
│   │   └── tmp
│   │       ├── bootJar
│   │       │   └── MANIFEST.MF
│   │       ├── compileJava
│   │       │   └── previous-compilation-data.bin
│   │       ├── compileTestJava
│   │       └── jar
│   │           └── MANIFEST.MF
│   ├── build.gradle
│   ├── .gitattributes
│   ├── .gitignore
│   ├── .gradle
│   │   ├── 8.0.2
│   │   │   ├── checksums
│   │   │   │   ├── checksums.lock
│   │   │   │   ├── md5-checksums.bin
│   │   │   │   └── sha1-checksums.bin
│   │   │   ├── dependencies-accessors
│   │   │   │   ├── dependencies-accessors.lock
│   │   │   │   └── gc.properties
│   │   │   ├── executionHistory
│   │   │   │   ├── executionHistory.bin
│   │   │   │   └── executionHistory.lock
│   │   │   ├── fileChanges
│   │   │   │   └── last-build.bin
│   │   │   ├── fileHashes
│   │   │   │   ├── fileHashes.bin
│   │   │   │   ├── fileHashes.lock
│   │   │   │   └── resourceHashesCache.bin
│   │   │   ├── gc.properties
│   │   │   └── vcsMetadata
│   │   ├── 8.5
│   │   │   ├── checksums
│   │   │   │   ├── checksums.lock
│   │   │   │   ├── md5-checksums.bin
│   │   │   │   └── sha1-checksums.bin
│   │   │   ├── dependencies-accessors
│   │   │   │   ├── dependencies-accessors.lock
│   │   │   │   └── gc.properties
│   │   │   ├── executionHistory
│   │   │   │   ├── executionHistory.bin
│   │   │   │   └── executionHistory.lock
│   │   │   ├── fileChanges
│   │   │   │   └── last-build.bin
│   │   │   ├── fileHashes
│   │   │   │   ├── fileHashes.bin
│   │   │   │   ├── fileHashes.lock
│   │   │   │   └── resourceHashesCache.bin
│   │   │   ├── gc.properties
│   │   │   └── vcsMetadata
│   │   ├── buildOutputCleanup
│   │   │   ├── buildOutputCleanup.lock
│   │   │   ├── cache.properties
│   │   │   └── outputFiles.bin
│   │   ├── file-system.probe
│   │   ├── vcs-1
│   │   │   └── gc.properties
│   │   ├── workspace-id.txt
│   │   └── workspace-id.txt.lock
│   ├── gradle
│   │   └── wrapper
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── settings.gradle
│   └── src
│       ├── main
│       │   ├── java
│       │   │   └── dk
│       │   │       └── ndlarsen
│       │   │           └── todo
│       │   │               ├── App.java
│       │   │               ├── GenericStorage.java
│       │   │               ├── InMemoryStorage.java
│       │   │               ├── TodoController.java
│       │   │               └── Todo.java
│       │   └── resources
│       └── test
│           ├── java
│           │   └── dk
│           │       └── ndlarsen
│           │           └── todo
│           │               └── AppTest.java
│           └── resources
└── todo-api.zip

110 directories, 94 files
$ ./gradlew compileJava

BUILD SUCCESSFUL in 887ms
1 actionable task: 1 up-to-date
$ ./gradlew bootRun

> Task :bootRun

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.5)

2024-04-21T19:21:48.399+02:00  INFO 304167 --- [todo-api] [  restartedMain] dk.ndlarsen.todoapi.TodoApiApplication   : Starting TodoApiApplication using Java 21.0.2 with PID 304167 (/home/ndlarsen/src/temp/todo-api/java/todo-api/build/classes/java/main started by ndlarsen in /home/ndlarsen/src/temp/todo-api/java/todo-api)
2024-04-21T19:21:48.401+02:00  INFO 304167 --- [todo-api] [  restartedMain] dk.ndlarsen.todoapi.TodoApiApplication   : No active profile set, falling back to 1 default profile: "default"
2024-04-21T19:21:48.431+02:00  INFO 304167 --- [todo-api] [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2024-04-21T19:21:48.432+02:00  INFO 304167 --- [todo-api] [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2024-04-21T19:21:48.977+02:00  INFO 304167 --- [todo-api] [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2024-04-21T19:21:48.985+02:00  INFO 304167 --- [todo-api] [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-04-21T19:21:48.985+02:00  INFO 304167 --- [todo-api] [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.20]
2024-04-21T19:21:49.008+02:00  INFO 304167 --- [todo-api] [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-04-21T19:21:49.009+02:00  INFO 304167 --- [todo-api] [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 576 ms
2024-04-21T19:21:49.207+02:00  INFO 304167 --- [todo-api] [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2024-04-21T19:21:49.223+02:00  INFO 304167 --- [todo-api] [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path ''
2024-04-21T19:21:49.229+02:00  INFO 304167 --- [todo-api] [  restartedMain] dk.ndlarsen.todoapi.TodoApiApplication   : Started TodoApiApplication in 1.067 seconds (process running for 1.303)
<==========---> 80% EXECUTING [6s]
> :bootRun

```console
$ code --version
1.88.1
e170252f762678dec6ca2cc69aba1570769a5d39
x64
code --list-extensions --show-versions | grep java
redhat.java@1.29.0
vscjava.vscode-gradle@3.13.5
vscjava.vscode-java-debug@0.57.0
vscjava.vscode-java-dependency@0.23.6
vscjava.vscode-java-test@0.41.0
vscjava.vscode-spring-initializr@0.11.2

error.log
output.txt
todo-api.zip

UPDATE:

Using the vscode gradle extension directly works fine, same is the case when using gradle via the java project manager (via command pallette). When picking the Quarkus option via the java project manager of using the Quarkus plugin directly, the java project manager is also failing to detect the project and I am seeing similar exceptions in the logs (see below). The generated code with Quarkus runs fine using ./gradlew quarkusDev.

java.util.concurrent.CompletionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: org.gradle.tooling.BuildException: Could not fetch model of type 'GradleSourceSets' using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-8.6-bin.zip'.
	at java.base/java.util.concurrent.CompletableFuture.reportJoin(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.join(Unknown Source)
	at com.microsoft.gradle.bs.importer.GradleBuildServerProjectImporter.importToWorkspace(GradleBuildServerProjectImporter.java:171)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.importProjects(ProjectsManager.java:162)
	at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.initializeProjects(ProjectsManager.java:124)
	at org.eclipse.jdt.ls.core.internal.handlers.InitHandler$1.runInWorkspace(InitHandler.java:263)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I can, however, wget the the resource just fine

$ wget https://services.gradle.org/distributions/gradle-8.6-bin.zip
--2024-04-21 20:03:05--  https://services.gradle.org/distributions/gradle-8.6-bin.zip
Resolving services.gradle.org (services.gradle.org)... 104.16.72.101, 104.16.73.101, 2606:4700::6810:4865, ...
Connecting to services.gradle.org (services.gradle.org)|104.16.72.101|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://github.com/gradle/gradle-distributions/releases/download/v8.6.0/gradle-8.6-bin.zip [following]
--2024-04-21 20:03:05--  https://github.com/gradle/gradle-distributions/releases/download/v8.6.0/gradle-8.6-bin.zip
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/696192900/30b914b2-256d-49b6-a68b-acaee9259642?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240421%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240421T180306Z&X-Amz-Expires=300&X-Amz-Signature=60cc30005692b6b277c5d8b734cbf58887f898020357260bf5d3372c72b4d539&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=696192900&response-content-disposition=attachment%3B%20filename%3Dgradle-8.6-bin.zip&response-content-type=application%2Foctet-stream [following]
--2024-04-21 20:03:06--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/696192900/30b914b2-256d-49b6-a68b-acaee9259642?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240421%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240421T180306Z&X-Amz-Expires=300&X-Amz-Signature=60cc30005692b6b277c5d8b734cbf58887f898020357260bf5d3372c72b4d539&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=696192900&response-content-disposition=attachment%3B%20filename%3Dgradle-8.6-bin.zip&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 132788867 (127M) [application/octet-stream]
Saving to: ‘gradle-8.6-bin.zip’

gradle-8.6-bin.zip                                   100%[=====================================================================================================================>] 126,64M  40,9MB/s    in 3,2s    

2024-04-21 20:03:09 (39,7 MB/s) - ‘gradle-8.6-bin.zip’ saved [132788867/132788867]

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 proyecto Gradle generado siguiendo los pasos indicados de Java Project Manager y, después, inspecciona error.log y output.txt. Rastrea el fallo desde GradleBuildServerProjectImporter.importToWorkspace y compáralo con el comportamiento de la extensión de Gradle que funciona correctamente. La tarea está completada cuando los proyectos de Spring Boot y Quarkus generados mediante el gestor de proyectos se detectan correctamente.

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

Evaluación

Stack tecnológico
java, spring-boot, vscode
Área
developer-experience, tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.