Skip to content
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

Allow specifying/overriding the parent in the pom file for Java and Spring #1132

Merged
merged 3 commits into from
Oct 9, 2018

Conversation

mwoodland
Copy link
Contributor

@mwoodland mwoodland commented Sep 27, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.3.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Add support for overriding/specifying the parent in the generated pom file.
issue #1131

The run-all-petstore.cmd command did't work as some of the scripts it calls are looking for jars in swagger-codegen-cli directory - hence why I haven't checked "ran the schell script" above.

I have checked using the Spring generator while specifying none of the parent properties, all of them and one of them.

@bbdouglas (2017/07) @JFCote (2017/08) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01)

@cbornet
Copy link
Member

cbornet commented Sep 27, 2018

I'm not sure about the value of adding 3 more fields just to add 3 lines in a pom...

@mwoodland
Copy link
Contributor Author

I'm not sure about the value of adding 3 more fields just to add 3 lines in a pom...

I'm not sure how other people use the generator, but I'm using it to generate a module that the rest of my project then depends on. I'm running the generator to create the module from scratch as part of every build (so that the latest changes to the OpenAPI spec files are applied every time).

After the module is generated, we don't want to have to make any changes to that module, we just want to have implemented the interfaces that are defined in the generated module in a separate module.

Currently it sort of works having the parent define the child project as a module, but the parent not specified in the child pom. But to avoid breaking some of my builds I have to specify the modules in a specific order so that the generated module is not processed first.

@mwoodland
Copy link
Contributor Author

Any updates on whether this pull request will be accepted? Or if there's anything else you'd like me to do?

@cbornet
Copy link
Member

cbornet commented Oct 4, 2018

Have you tried using your own template for this instead ? You can do it by just providing a template dir with the -t option during generation in which you only provide your custom pom.mustache file

@mwoodland
Copy link
Contributor Author

I've done exactly that but figured I wouldn't be the only person who would want this functionality and as it's unintrusive change I thought I might as well submit a pull request. As a plus side it also means I wouldn't have to merge any changes to the template whenever I start using a new version of the generator.

@wing328
Copy link
Member

wing328 commented Oct 8, 2018

@mwoodland as discussed, please consider using -t moving forward as we want to avoid adding too many options to generators.

@wing328
Copy link
Member

wing328 commented Oct 8, 2018

I've restarted the Travis build and will merge this PR into master once the build passes.

@wing328 wing328 merged commit 8c0e130 into OpenAPITools:master Oct 9, 2018
@mwoodland mwoodland deleted the overrideParent branch October 9, 2018 07:51
@wing328 wing328 changed the title Allow specifying/overriding the parent in the pom file for Java and S… Allow specifying/overriding the parent in the pom file for Java and Spring Oct 15, 2018
@wing328
Copy link
Member

wing328 commented Oct 16, 2018

@mwoodland thanks again for the enhancement, which has been included in the v3.3.1 release: https://twitter.com/oas_generator/status/1052020299821080577

A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
OpenAPITools#1132)

* Allow specifying/overriding the parent in the pom file for Java and Spring generators.

* Don't add extra whitespace to the pom file when the parent isn't overridden.

* Remove accidentally added white space.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants