This is an automated email from the ASF dual-hosted git repository. exceptionfactory pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 94e746dc4701814ede160d7e0f5793a3e1cf76db Author: Mark Bean <[email protected]> AuthorDate: Fri Oct 27 16:38:18 2023 +0000 NIFI-12283 Added include-swagger-ui profile with activation by default Deactivating prevents attempt to download swagger asset from the Internet allowing for offline builds. This closes #7945 Signed-off-by: David Handermann <[email protected]> --- .../nifi-registry-web-api/pom.xml | 142 +++++++++++---------- 1 file changed, 78 insertions(+), 64 deletions(-) diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml index 9a1bf653b3..cce8776de0 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml @@ -147,70 +147,6 @@ </dependency> </dependencies> </plugin> - <plugin> - <groupId>com.googlecode.maven-download-plugin</groupId> - <artifactId>download-maven-plugin</artifactId> - <version>1.7.1</version> - <executions> - <execution> - <id>download-swagger-ui</id> - <!-- This plugin downloads swagger UI static assets during the build, to be - served by the web app to render the dynamically generated Swagger spec. - For offline development, or to build without the swagger UI, activate - the "no-swagger-ui" maven profile during the build with the "-P" flag --> - <goals> - <goal>wget</goal> - </goals> - <configuration> - <url>https://github.com/swagger-api/swagger-ui/archive/v${swagger.ui.version}.tar.gz</url> - <unpack>true</unpack> - <outputDirectory>${project.build.directory}</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <id>bundle-swagger-ui</id> - <phase>prepare-package</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <target> - <sequential> - <echo>Copy static Swagger UI files to target</echo> - <copy todir="${project.build.directory}/classes/static/swagger"> - <fileset dir="${project.build.directory}/swagger-ui-${swagger.ui.version}/dist"> - <include name="**" /> - </fileset> - </copy> - <echo>Disable schema validation by removing validatorUrl</echo> - <replace token="https://online.swagger.io/validator" value="" dir="${project.build.directory}/classes/static/swagger"> - <include name="swagger-ui-bundle.js" /> - <include name="swagger-ui-standalone-preset.js" /> - </replace> - <echo>Rename 'index.html' to 'ui.html'</echo> - <move file="${project.build.directory}/classes/static/swagger/index.html" tofile="${project.build.directory}/classes/static/swagger/ui.html" /> - <echo>Replace default swagger.json location</echo> - <replace token="http://petstore.swagger.io/v2/swagger.json" value="/nifi-registry-api/swagger/swagger.json" dir="${project.build.directory}/classes/static/swagger"> - <include name="ui.html" /> - </replace> - <echo>Copy swagger.json into static assets folder</echo> - <copy todir="${project.build.directory}/classes/static/swagger"> - <fileset dir="${project.build.directory}/swagger"> - <include name="*.json" /> - </fileset> - </copy> - </sequential> - </target> - </configuration> - </execution> - </executions> - </plugin> <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> @@ -223,6 +159,84 @@ </plugins> </build> + <profiles> + <profile> + <id>include-swagger-ui</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <groupId>com.googlecode.maven-download-plugin</groupId> + <artifactId>download-maven-plugin</artifactId> + <version>1.7.1</version> + <executions> + <execution> + <id>download-swagger-ui</id> + <!-- This plugin downloads swagger UI static assets during the build, to be + served by the web app to render the dynamically generated Swagger spec. + For offline development, or to build without the swagger UI, deactivate + the "include-swagger-ui" maven profile during the build with the following + profile option: -P'!include-swagger-ui' --> + <goals> + <goal>wget</goal> + </goals> + <configuration> + <url>https://github.com/swagger-api/swagger-ui/archive/v${swagger.ui.version}.tar.gz</url> + <unpack>true</unpack> + <outputDirectory>${project.build.directory}</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>bundle-swagger-ui</id> + <phase>prepare-package</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <target> + <sequential> + <echo>Copy static Swagger UI files to target</echo> + <copy todir="${project.build.directory}/classes/static/swagger"> + <fileset dir="${project.build.directory}/swagger-ui-${swagger.ui.version}/dist"> + <include name="**" /> + </fileset> + </copy> + <echo>Disable schema validation by removing validatorUrl</echo> + <replace token="https://online.swagger.io/validator" value="" dir="${project.build.directory}/classes/static/swagger"> + <include name="swagger-ui-bundle.js" /> + <include name="swagger-ui-standalone-preset.js" /> + </replace> + <echo>Rename 'index.html' to 'ui.html'</echo> + <move file="${project.build.directory}/classes/static/swagger/index.html" tofile="${project.build.directory}/classes/static/swagger/ui.html" /> + <echo>Replace default swagger.json location</echo> + <replace token="http://petstore.swagger.io/v2/swagger.json" value="/nifi-registry-api/swagger/swagger.json" dir="${project.build.directory}/classes/static/swagger"> + <include name="ui.html" /> + </replace> + <echo>Copy swagger.json into static assets folder</echo> + <copy todir="${project.build.directory}/classes/static/swagger"> + <fileset dir="${project.build.directory}/swagger"> + <include name="*.json" /> + </fileset> + </copy> + </sequential> + </target> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <dependencies> <dependency> <groupId>org.springframework.boot</groupId>
