sylvainlaurent / yaml-json-validator-maven-plugin

A maven plugin to check that YAML and JSON files are well formed and optionally valid against JSON schemas
Apache License 2.0
22 stars 14 forks source link

Not finding YAML files to validate if not in src/main/resources #20

Closed larissaleite closed 4 years ago

larissaleite commented 4 years ago

Hi! I have been trying to use the plugin but it doesn't find YAML files that are not in src/main/resources. I have a different structure on my project and would very much like to use this to validate my YAML files. Is there a workaround?

Thanks!

wilx commented 4 years ago

See the https://github.com/sylvainlaurent/yaml-json-validator-maven-plugin. It shows how to use <includes>.

larissaleite commented 4 years ago

I did, I have a bunch of YAML files under several nested directories inside a top-level configs directory and using <include>${basedir}/configs/**/*.yml</include> doesn't work.

larissaleite commented 4 years ago

Closing this issue as I realized that it's not necessary to have ${basedir} in the path. Without ${basedir} it works

cvakiitho commented 4 years ago

Sorry to comment on closed issue, but I have the same problem, minimal repro pom + yaml : https://github.com/cvakiitho/yaml-maven-example/blob/master/pom.xml

wilx commented 4 years ago

@cvakiitho You are doing it wrong. You only introduced the plugin management but you forgot to invoke the plugin. Also, you put ... for a version. This fixes it:

diff --git a/pom.xml b/pom.xml
index 61bae5a..580eacd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
         <plugin>
           <groupId>com.github.sylvainlaurent.maven</groupId>
           <artifactId>yaml-json-validator-maven-plugin</artifactId>
-        <version>...</version>
+          <version>1.0.4</version>
           <executions>
             <execution>
               <id>validate</id>
@@ -42,5 +42,11 @@
         </plugin>
       </plugins>
     </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>com.github.sylvainlaurent.maven</groupId>
+        <artifactId>yaml-json-validator-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
   </build>
 </project>
cvakiitho commented 4 years ago

Thanks @wilx! Long time has passed since I used maven plugins, my bad.