dk.swissarmyronin:swagger-packaging-maven-plugin

A packaging plugin for storing versioned Swagger files in a repository.

Лицензия

Лицензия

Категории

Категории

Maven Компиляция и сборка Swagger Межпрограммное взаимодействие REST Frameworks
Группа

Группа

dk.swissarmyronin
Идентификатор

Идентификатор

swagger-packaging-maven-plugin
Последняя версия

Последняя версия

1.2
Дата

Дата

Тип

Тип

maven-plugin
Описание

Описание

dk.swissarmyronin:swagger-packaging-maven-plugin
A packaging plugin for storing versioned Swagger files in a repository.
Ссылка на сайт

Ссылка на сайт

https://github.com/SwissArmyRonin/swagger-packaging-maven-plugin
Система контроля версий

Система контроля версий

https://github.com/SwissArmyRonin/swagger-packaging-maven-plugin

Скачать swagger-packaging-maven-plugin

Как подключить последнюю версию

<plugin>
    <groupId>dk.swissarmyronin</groupId>
    <artifactId>swagger-packaging-maven-plugin</artifactId>
    <version>1.2</version>
</plugin>

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.apache.maven : maven-plugin-api jar 2.0
org.codehaus.plexus : plexus-utils jar 3.0.8
org.apache.maven : maven-core jar 3.1.1

provided (1)

Идентификатор библиотеки Тип Версия
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.2

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.8.2

Модули Проекта

Данный проект не имеет модулей.

Swagger definition packaging

This plugin allows developers to treat Swagger YAML files as Maven modules. Swagger files are installed in the local repository and can be deployed to remote repositories.

Usage

NB: There is a problem with version 1.2, so the examples below use version 1.1.

To create a Swagger definition module, create a project containing the Swagger YAML definition with a POM file like the one in this example:

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>dk.swissarmyronin.services</groupId>
  <artifactId>example-service</artifactId>
  <version>1.0</version>
  <packaging>swagger</packaging>
  <build>
    <plugins>
      <plugin>
        <groupId>dk.swissarmyronin</groupId>
        <artifactId>swagger-packaging-maven-plugin</artifactId>
        <version>1.1</version>
        <extensions>true</extensions>
        <configuration>
          <sourceDir>${basedir}/src/main/resources</sourceDir> <!-- Optional: defaults to ${project.basedir} -->
          <swaggerFile>example.yaml</swaggerFile> <!-- Optional: defaults to "${project.artifactId}.yaml" -->
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

To use the file for code generation in another project, insert the following plugin snippets in that project's POM file:

...
<plugins>
  <plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>3.0.2</version>
    <executions>
      <execution>
        <id>copy-swagger</id>
        <phase>initialize</phase>
        <goals>
          <goal>copy</goal>
        </goals>
        <configuration>
          <artifactItems>
            <artifactItem>
              <groupId>dk.tmnet.tmt</groupId>
              <artifactId>example-service</artifactId>
              <version>1.0</version>
              <type>yaml</type>
              <outputDirectory>${project.basedir}/src/main/resources</outputDirectory>
              <destFileName>example-service.yaml</destFileName>
            </artifactItem>
          </artifactItems>
          <overWriteSnapshots>true</overWriteSnapshots>
        </configuration>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>2.2.3</version>
    <executions>
      <execution>
        <id>generate-swagger</id>
        <goals>
          <goal>generate</goal>
        </goals>
        <configuration>
          <inputSpec>${project.basedir}/src/main/resources/example-service.yaml</inputSpec>
          <language>jaxrs</language>
          <output>${project.build.directory}/generated-sources/swagger</output>
        </configuration>
      </execution>
    </executions>
  </plugin>
...

If you have other projects, say Angular or .NET projects that need the Swagger file, they can download it at build time with the following command line (provided they have Maven installed):

mvn dependency:copy -Dartifact=dk.swissarmyronin.services:example-service:1.0:yaml -DoutputDirectory=.

... outputs "example-service-1.0.yaml" to current directory.

dk.swissarmyronin

SwissArmyRonin

Версии библиотеки

Версия
1.2
1.1