changeset 303:ec8316f2d020 default tip master

Fail build on YAML lint error Fail the build on bad swagger files, but "-Dmaven.test.skip=true" will skip the YAML check. Reviewed-by: neugens Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-October/025574.html
author Simon Tooke <stooke@redhat.com>
date Tue, 31 Oct 2017 09:53:02 -0400
parents 5e79312c8075
children
files pom.xml services/schema/pom.xml
diffstat 2 files changed, 68 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/pom.xml	Mon Oct 30 09:51:28 2017 -0400
+++ b/pom.xml	Tue Oct 31 09:53:02 2017 -0400
@@ -60,7 +60,7 @@
     </modules>
 
     <properties>
-        <thermostat.common.version>0.1.3</thermostat.common.version>
+        <thermostat.common.version>0.1.4</thermostat.common.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
--- a/services/schema/pom.xml	Mon Oct 30 09:51:28 2017 -0400
+++ b/services/schema/pom.xml	Tue Oct 31 09:53:02 2017 -0400
@@ -50,60 +50,75 @@
 
     <name>Thermostat Web Gateway Schema service</name>
 
+	<profiles>
+        <profile>
+            <id>lint</id>
+            <activation>
+                <property>
+                    <name>maven.test.skip</name>
+                    <value>!true</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+
+                    <!-- generate list of swagger files -->
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>listSwaggerFiles</id>
+                                <phase>test</phase>
+                                <configuration>
+                                    <tasks>
+                                        <mkdir dir="${project.build.directory}"/>
+                                        <pathconvert property="swagger.matches" pathsep="${line.separator}">
+                                            <fileset dir="${basedir}/.." includes="**/src/main/resources/*-swagger.yaml"/>
+                                            <fileset dir="${basedir}/.." includes="**/src/main/resources/*-swagger.json"/>
+                                        </pathconvert>
+                                        <echo message="found Swagger files: ${line.separator}${swagger.matches}"/>
+                                        <echo message="${swagger.matches}" file="${project.build.directory}/swaggerfiles.txt"/>
+                                    </tasks>
+                                </configuration>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <!-- combine swagger files with no output, do lint check -->
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <version>1.6.0</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <phase>test</phase>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <mainClass>com.redhat.thermostat.common.swaggercombine.SwaggerCombineMain</mainClass>
+                            <arguments>
+                                <argument>--lint</argument>
+                                <argument>--output=</argument>
+                                <argument>--throw</argument>
+                                <argument>${basedir}/src/main/webapp/WEB-INF/swagger-template.json</argument>
+                                <argument>@${project.build.directory}/swaggerfiles.txt</argument>
+                            </arguments>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
     <build>
         <plugins>
-
-
-             <!-- generate list of swagger files -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>listSwaggerFiles</id>
-                        <phase>test</phase>
-                        <configuration>
-                            <tasks>
-                                <mkdir dir="${project.build.directory}"/>
-                                <pathconvert property="swagger.matches" pathsep="${line.separator}">
-                                    <fileset dir="${basedir}/.." includes="**/src/main/resources/*-swagger.*"/>
-                                </pathconvert>
-                                <echo message="found Swagger files: ${line.separator}${swagger.matches}"/>
-                                <echo message="${swagger.matches}" file="${project.build.directory}/swaggerfiles.txt"/>
-                            </tasks>
-                        </configuration>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <!-- combine swagger files with no output -->
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>exec-maven-plugin</artifactId>
-                <version>1.6.0</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>java</goal>
-                        </goals>
-                        <phase>test</phase>
-                    </execution>
-                </executions>
-                <configuration>
-                    <mainClass>com.redhat.thermostat.common.swaggercombine.SwaggerCombineMain</mainClass>
-                    <arguments>
-                        <argument>--lint</argument>
-                        <argument>--output=</argument>
-                        <argument>--throw</argument>
-                        <argument>${basedir}/src/main/webapp/WEB-INF/swagger-template.json</argument>
-                        <argument>@${project.build.directory}/swaggerfiles.txt</argument>
-                    </arguments>
-                </configuration>
-            </plugin>
-
             <!-- ensure war file includes docs directory -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>