OpenAPITools / OpenAPITools/openapi-generator
[BUG][Maven Plugin] openapi-generator-maven-plugin IntelliJ classpath configuration issues
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I'm not entirely certain this issue is for the plugin, and not the IDE. But since the only delta between the two is the plugin configuration, I assume its a plugin issue.
I'm trying to migrate a project from the Swagger Maven plugin, to this one. But when loading a project with the Maven plugin into IntelliJ, the classloader is mis-configured for the IDE. it points to a sub-folder for the source.
openapi-generator version
5.1.0
Steps to reproduce
Showing valid state:
- Clone project: https://github.com/adobe/aio-lib-java-cloudmanager/
- Create new IntelliJ workspace
- Import the cloned Maven project. (Reload/Trust the project so it builds)
- In the Maven context, select
Generate Sources and Update Folders - At this point, the project should successfully compile, and if you check this folder it indicates it is a source folder
target/generated-sources/swagger/src/main/java
Show invalid state:
- Run a maven clean and reload the project from the file system, ensuring that the
targetfolder is removed. - You may need to edit the source folder configuration to remove the previously configured generated source path (Optional Step)
- Replace the pom with the contents of this gist
- In the Maven context, select
Generate Sources and Update Folders - The IDE will show the following folders as a source
target/generated-sources/swagger/src/main/java/io/adobe/cloudmanager/jwt/swagger
The primary difference between the two is the generator plugin. I have tried different package definitions, and arrangements of the plugin execution configurations. However, it always seems to set it to .../jwt/* as the only generated classpath. It also sets the src/test/java path as a classpath, even though this is disabled in the plugin by default.
Related issues/PRs
Suggest a fix
I compared the Swagger Plugin's CodeGenMojo to see what may be different and found these lines. However, when i tried to add something similar and test locally, it didn't have any impact.
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
Reproduce the two IntelliJ/Maven states using adobe/aio-lib-java-cloudmanager and the replacement pom from the linked gist. Start by comparing the Maven plugin configuration with the referenced Swagger CodeGenMojo.java lines. Done means generated sources use target/generated-sources/swagger/src/main/java as the source root and src/test/java is not added as a classpath.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100