swagger-api / swagger-api/swagger-codegen

Java import-mappings require manual modification of pom.xml to compile generated code

Open
#7,207 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Java General: Question
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I have a shared Java package that contains the data model classes that will be used by my Spring Boot API server and also by Java clients. I can specify these classes with the importMappings configuration option. However, there is no method I can find where I can add the library that contains those classes as a dependency in the generated pom.xml. The pom file must be modified after generation in order to compile the generated code which references the mapped classes. This presents a problem for automated bulds. Yes it can be scripted, but we're so close to having everything in place.

Or is there some feature that can do this and I just haven't found the right documentation yet?

Swagger-codegen version

Maven plulgin 2.3.0-SNAPSHOT

Swagger declaration file content or url

N/A

Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Add a configuration option related to importMappings where the user can specify the group/artifact/version to provide the mapped classes and include that dependency in the generated build files

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's handling of importMappings and the generated pom.xml; the issue does not identify a source file or test. Determine how a mapped library could be specified and included in generated build files, with completion shown by generated Java code compiling without manual pom.xml edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.