redhat-developer / redhat-developer/vscode-java

Out of the box support for swagger-codegen-maven-plugin

Aperta
#935 11 commenti 20 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

There is no support for automatically detecting and adding to the classpath the automatically generated code by the swagger-codegen-maven-plugin.

This means that, even though the project builds without issues from the command line, all the java classes that import the auto-generated code complain that those imports don't exist from within VSCode.

A work-around is following the same advice you gave for "Annotation Processing support for Maven projects" at: https://github.com/redhat-developer/vscode-java/wiki/Annotation-Processing-support-for-Maven-projects.

i.e. you add the generated source code path with the build-helper-maven-plugin to your pom manually, but this is not ideal.

e.g. assuming <sourceFolder>src/main/java</sourceFolder>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <!-- Need to ensure the generated source folder is added to the project classpath, in jdt.ls -->
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-sources/swagger/src/main/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Any chances to get this done automatically? Or at the very least, could you add this to the documentation for others that stumble on the same issue?

Thanks

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 con la configurazione del progetto Maven indicata nell’issue, inclusa la configurazione di pom.xml di build-helper-maven-plugin e la documentazione collegata sul supporto ad Annotation Processing. Confronta la gestione del classpath di VSCode con la build da riga di comando per l’output di swagger-codegen-maven-plugin; il lavoro è completo quando gli import Java generati vengono risolti automaticamente oppure il workaround è documentato.

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

Valutazione

Stack tecnologico
java, vscode
Ambito
build-system
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.