Skip to content

Instantly share code, notes, and snippets.

@CSchulz

CSchulz/pom.xml Secret

Last active May 11, 2016 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CSchulz/5042d9071d2f50eaca7696dec8911af3 to your computer and use it in GitHub Desktop.
Save CSchulz/5042d9071d2f50eaca7696dec8911af3 to your computer and use it in GitHub Desktop.
swagger ui via dependency plugin
<profile>
<id>swagger-ui</id>
<build>
<plugins>
<!-- Step 1. - Download Swagger UI webjar -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>swagger ui</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>${swagger-ui.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/swagger-ui</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- Step 2. Add Swagger-ui Resources to the WAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources combine.children="append">
<resource>
<directory>${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}</directory>
<includes>
<include>**/*.*</include>
</includes>
<targetPath>swagger-ui</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment