Skip to content

[REQ] [JAVA] maven plugin generates test in generated-test-sources #10917

@feech

Description

@feech

Is your feature request related to a problem? Please describe.

Maven uses two different folders generated-sources and generated-test-sources. Test related files supose to get into generated-test-source folder. In current implementation all generated files in a single forlder - ${project.build.directory}/generated-sources/openapi by default.

there are problems with the approach:

  • test files go to production artifact
  • production artifact becomes dependencies (it increses dangerous in the light of recent vulnerability in logging library - the more non essential libraries in prod the likely to catch new vulnerability)

I suspect that majority of java developers just disable generating the test files

I wonder if it it possible to make mvn plugin alligned with conventional folder-structure

Describe the solution you'd like

The solution is to introduce additional parameter testOutput which is ${project.build.directory}/generated-test-sources/openapi by default.

Describe alternatives you've considered

there are several workarounds:

  • copy test files after generation with another maven plugin
  • use org.codehouse.mojo:build-helper-maven-plugin to mark the folder with test files as mvn-test-source

both of these ways have different flaws

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions