swagger-api / swagger-api/swagger-codegen

Java code from example pom (java-client.xml) doesn't compile

Open
#8,071 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Using this example pom results in Java code that doesn't compile due to a jersey dependency.
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen-maven-plugin/examples/java-client.xml

An example error is:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project tutorial-network: Compilation failure: Compilation failure:
[ERROR] /Users/charters/Repositories/github/composer-tutorial/tutorial-network/java/target/generated-sources/swagger/src/main/java/__default/package_/ApiClient.java:[28,36] package org.glassfish.jersey.logging does not exist
[ERROR] /Users/charters/Repositories/github/composer-tutorial/tutorial-network/java/target/generated-sources/swagger/src/main/java/__default/package_/ApiClient.java:[760,33] cannot find symbol
Swagger-codegen version
                <groupId>io.swagger</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>2.3.1</version>
Swagger declaration file content or url

N/A

Command line used for generation

Build using the maven pom (java-client.xml) referenced earlier

Steps to reproduce

Create a maven project with a simple swagger document.
Use the example pom referenced earlier.
Build the project mvn compile

Related issues/PRs

I didn't find any related Issues/PRs

Suggest a fix/enhancement

Upping the version of jersey in the java-client.xml files fixes the build:

        <jersey-version>2.27</jersey-version>

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 modules/swagger-codegen-maven-plugin/examples/java-client.xml and reproduce the failure using a simple Swagger document and mvn compile. Check the Jersey dependency version used by the example against the missing org.glassfish.jersey.logging classes. Done means the generated Java client compiles successfully with the example pom.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.