redhat-developer / redhat-developer/vscode-java
Out of the box support for swagger-codegen-maven-plugin
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Maven project setup in the issue, including the pom.xml build-helper-maven-plugin configuration and the linked Annotation Processing support documentation. Compare VSCode's classpath handling with the command-line build for swagger-codegen-maven-plugin output; done means generated Java imports resolve automatically, or the workaround is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, vscode
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100