Home > Enterprise >  Java Maven openapi/swaggerui generate file script
Java Maven openapi/swaggerui generate file script

Time:05-29

I have a project built in Java Springboot Maven. I'm trying to provide an open api doc for internal use only, so it's not hosted publicly. It currently generates an openapi file upon build, but it's causing some issues in the pipelines. Is there a way to configure it to only generate a new file when I run a specific script?

I currently have version 1.4.8 of springdoc-openapi-ui.

Thanks in advance!

CodePudding user response:

I think you can do this specifying a profile in your pom.xml

  <profiles>
    <profile>
      <id>generate-doc</id>
      <build>
        <plugins>
          <plugin>
    ...
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

Then you can run it with mvn clean install -Pgenerate-doc to generate your files.

CodePudding user response:

f you are using Maven, you can just set org.springdoc(I had the same error, so i changed from io.springfox to org.springdo) in pom.xml:

<dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-boot-starter</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>3.0.0</version>
    </dependency>

You can use :

<dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-ui</artifactId>
        <version>1.2.32</version>
    </dependency>
  • Related