redhat-developer / redhat-developer/vscode-java

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

未关闭
#935 11 条评论 20 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

codegen Maven
主要语言
TypeScript
星标
2.3k
派生
546
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中的 Maven 项目设置开始,包括 pom.xml 中的 build-helper-maven-plugin 配置以及链接的 Annotation Processing 支持文档。将 VSCode 的 classpath 处理方式与 swagger-codegen-maven-plugin 输出的命令行构建进行比较;当生成的 Java 导入能够自动解析,或 workaround 已记录在文档中时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
build-system
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。