Skip to content

[BUG] packageName ignored by maven plugin #2428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 of 6 tasks
Zomzog opened this issue Mar 16, 2019 · 4 comments · Fixed by #2429
Closed
4 of 6 tasks

[BUG] packageName ignored by maven plugin #2428

Zomzog opened this issue Mar 16, 2019 · 4 comments · Fixed by #2429

Comments

@Zomzog
Copy link
Contributor

Zomzog commented Mar 16, 2019

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

packageName not used by maven plugin, infrastructure is genereted in default package.

openapi-generator version

3.2.2 and 4.0.0-SNAPSHOT

OpenAPI declaration file content or url

Maven config

<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
    <execution>
        <goals>
            <goal>generate</goal>
        </goals>
        <configuration>
            <inputSpec>${project.basedir}/src/main/resources/swagger.json</inputSpec>
            <generatorName>kotlin</generatorName>
            <configOptions>
                <sourceFolder>src/gen/kotlin/main</sourceFolder>
            </configOptions>
            <packageName>bzh.zomzog.utils</packageName>
            <generateSupportingFiles>true</generateSupportingFiles>
        </configuration>
    </execution>
</executions>
Command line used for generation

mvn clean install

Steps to reproduce

Generate a kotlin client with custom packageName

Related issues/PRs
Suggest a fix

Add support of packageName to maven plugin

@wing328
Copy link
Member

wing328 commented Mar 17, 2019

Have you tried putting packageName inside <configOptions> ... </configOptions>?

@Zomzog
Copy link
Contributor Author

Zomzog commented Mar 17, 2019

It works but I think it's a strange behavior because all other configurations are in the <configuration> level.

@wing328
Copy link
Member

wing328 commented Mar 17, 2019

There are 2 types of options: global options vs generator-specifed options.

packageName is a generator's option (as Ruby, Perl, etc use "moduleName" instead) so it should be inside the configOptions block.

@q3769-patientpoint
Copy link

q3769-patientpoint commented Aug 19, 2024

I just tried 7.8.0. The pacakgeName has no effect in or outside configOptions element. Only way to change the base package is using apiPackage/modelPackage/invokerPackage elements inside the configOptions element. @wing328 @jimschubert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants