-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out of the box support for swagger-codegen-maven-plugin #935
Comments
I'm having the same problem (and using the same workaround) with jaxb2-maven-plugin so it seems like a general issue with plugins that add source folders. |
Also seeing this issue with immutables.io and a custom generated sources plugin. Both output to the generated-sources directory and it's really frustrating to have to add this config to all my project pom files, especially since it's only necessary for vscode |
Would it be possible to enable When I try to do this, I get the following error:
|
Hit the same issue with Antlr plugin. As maven don't require you to manually add source files for plugins that supports the generate-sources phase and handles it automatically, shouldn't vscode be able to do the same? Adding manual configuration makes the POM with redundant information and is very annoying. |
Tried multiple maven projects using generate-source plugins, some of them are recognized well by vscode-java, some not. generate-source is not recognized: generate-source is automatically added to .classpath: Open stringtemplate4 project in eclipse, and the generated antlr3 folder is not added to .classpath at first and the pom.xml reports an error about generate-source goal. Then eclipse prompts me to install m2e-connector for the antlr3-maven-plugin. Follow the instruction to install m2e-connector, and restart eclipse. eclipse recognized the generated antlr3 folder well. @fbricon Is there any gap between jdt.ls and eclipse? |
jdt.ls doesn't have a mechanism for discovery and installation of remote m2e connectors. And we cannot maintain support for all m2e connectors for every Maven plugin there is. So yes there's a gap. I think m2e needs a better, more generic solution for discovering generated source folders |
I see. The current m2e leverages lifecycle-mapping-metadata to recognize the customized generate-sources goal from the maven plugin. Here is a wiki about how m2e lookup the lifecycle mapping from different places. Both antlr4-maven-plugin and jaxb2-maven-plugin provide m2e lifecycle-mapping-metadata in the plugin itself, that's why vscode-java can handle them well.
I summarized the possible solutions for such kind of issue:
|
I've tried adding the workaround found in the first post but I still can't get VSCode to recognize the classes generated by the swagger generation plugin.
Still, the classes generated by swagger are not visible in VSCode and marked as errors and I don't see the source folder added to the Maven panel. And in the project configuration: Do I need to add anything else to the POM to get VSCode to recognize the swagger generation folder? |
Has this still never been addressed? |
No. Auto generated code is not recognized by the VS Code Java plugin and there isn't any way to edit the classpath manually. So if you need auto generated code in your Maven project, IntelliJ or Eclipse are your only choices (I don't know if Netbeans supports auto generated code or not) |
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>
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
The text was updated successfully, but these errors were encountered: