Ask a Question

Problem with swagger generator (Maven codegen plugin)

FernandoGarcia1
Regular Visitor

Problem with swagger generator (Maven codegen plugin)

I am trying to generate my server code through maven codegen plugin,I don't really know what's the issue, could it be the swagger version? It doen't specify what error there is, only that those libraries are missing even if I try to add them manually and it continues to fail

 

  1. [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/auth/HttpBasicAuth.java:[18,27] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[25,31] package com.google.gson.reflect does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ApiClient.java:[17,41] package com.squareup.okhttp.internal.http does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ApiClient.java:[18,35] package com.squareup.okhttp.logging does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ApiClient.java:[19,58] package com.squareup.okhttp.logging.HttpLoggingInterceptor does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ProgressResponseBody.java:[16,27] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ProgressResponseBody.java:[17,27] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ProgressResponseBody.java:[27,43] cannot find symbol
    [ERROR] symbol: class ResponseBody
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ProgressRequestBody.java:[16,27] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ProgressRequestBody.java:[17,27] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/ProgressRequestBody.java:[27,42] cannot find symbol
    [ERROR] symbol: class RequestBody
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[65,31] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[108,32] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[151,31] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[183,31] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[225,32] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[263,31] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[297,31] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[340,32] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[386,31] package com.squareup.okhttp does not exist
    [ERROR] /D:/eclipse workspace/SwaggerSpringDemo-master/target/generated-sources/petstore/src/main/java/com/pet/handler/StoreApi.java:[420,31] package com.squareup.okhttp does not exist

 

Here my pom.xml , it's literally copy https://github.com/parimal-andhalkar/swagger-codegen-springboot/blob/main/pom.xml

 

  • <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>io.swagger</groupId>
    <artifactId>sample-project</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>sample-project</name>
    <url>http://maven.apache.org</url>


    <build>
    <plugins>
    <!-- activate the plugin -->
    <plugin>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>2.3.1</version>
    <executions>
    <execution>
    <goals>
    <goal>generate</goal>
    </goals>
    <configuration>
    <inputSpec>src/main/resources/swagger.yaml</inputSpec>
    <output>${project.build.directory}/generated-sources/petstore</output>
    <apiPackage>com.pet.handler</apiPackage>
    <modelPackage>com.pet.model</modelPackage>
    <language>java</language>
    <configOptions>
    <dateLibrary>java8</dateLibrary>
    <sourceFolder>src/main/java</sourceFolder>
    </configOptions>
    </configuration>
    </execution>
    </executions>
    </plugin>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    </plugins>
    </build>
    <dependencies>
    <!-- dependencies are needed for the client being generated -->
    <dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>logging-interceptor</artifactId>
    <version>3.12.1</version>
    </dependency>
    <dependency>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-annotations</artifactId>
    <version>${swagger-annotations-version}</version>
    </dependency>

    <!-- HTTP client: jersey-client -->
    <dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
    <version>${jersey-version}</version>
    </dependency>
    <dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>${jersey-version}</version>
    </dependency>
    <dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-multipart</artifactId>
    <version>${jersey-version}</version>
    </dependency>

    <!-- JSON processing: jackson -->
    <dependency>
    <groupId>com.fasterxml.jackson.jaxrs</groupId>
    <artifactId>jackson-jaxrs-base</artifactId>
    <version>${jackson-version}</version>
    </dependency>
    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>${jackson-version}</version>
    </dependency>
    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>${jackson-version}</version>
    </dependency>
    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>${jackson-version}</version>
    </dependency>
    <dependency>
    <groupId>com.fasterxml.jackson.jaxrs</groupId>
    <artifactId>jackson-jaxrs-json-provider</artifactId>
    <version>${jackson-version}</version>
    </dependency>

    <!-- Joda time: if you use it -->
    <dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-joda</artifactId>
    <version>${jackson-version}</version>
    </dependency>
    <dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>${jodatime-version}</version>
    </dependency>

    <dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.0.0-M5</version>
    <scope>test</scope>
    </dependency>

    <!-- Base64 encoding that works in both JVM and Android -->
    <dependency>
    <groupId>com.brsanthu</groupId>
    <artifactId>migbase64</artifactId>
    <version>2.2</version>
    </dependency>


    </dependencies>

    <properties>
    <swagger-annotations-version>1.5.21</swagger-annotations-version>
    <jersey-version>2.29.1</jersey-version>
    <jackson-version>2.11.4</jackson-version>
    <jodatime-version>2.7</jodatime-version>
    <maven-plugin-version>1.0.0</maven-plugin-version>
    <junit-version>4.13.1</junit-version>

    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    </project>
0 REPLIES 0
cancel
Showing results for 
Search instead for 
Did you mean: