OpenAPITools / OpenAPITools/openapi-generator

[BUG] Maven plugin ignore sourceFolder for test classes

Open
#2,079 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Retrofit Issue: Bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.