OpenAPITools / OpenAPITools/openapi-generator
[BUG] Maven plugin ignore sourceFolder for test classes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
I am using the maven plugin to generate the code.
The following xml snippet shows the configuration:
<configuration>
<output>${project.basedir}</output>
<!-- specify the swagger yaml -->
<inputSpec>${project.basedir}/../api/swagger/swagger.yaml</inputSpec>
<!-- target to generate java client code -->
<language>java</language>
<generateApiTests>true</generateApiTests>
<generateModelTests>true</generateModelTests>
<configOptions>
<!-- dateLibrary>java8</dateLibrary -->
<dateLibrary>joda</dateLibrary>
<invokerPackage>com.someco.api.client.invoker</invokerPackage>
<apiPackage>com.someco.api.client.api</apiPackage>
<modelPackage>com.someco.api.client.model</modelPackage>
<sourceFolder>src/gen/java</sourceFolder>
<serializableModel>true</serializableModel>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
</configOptions>
<!-- override the default library to jersey2 -->
<library>retrofit2</library>
</configuration>
The API and model classes are generated in the expected folder src/gen/java, but the test classes are still generated in src/test/java
openapi-generator version
Latest version
OpenAPI declaration file content or url
Any definition
Command line used for generation
I have used the maven plugin
Steps to reproduce
Run mvn clean install
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 plugin configuration handling for sourceFolder and compare where API/model tests versus generated source files are written. Reproduce the issue with the provided configuration using mvn clean install. Done means test classes also use src/gen/java rather than remaining in src/test/java.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100