I’m using flyway in my java web project.
My migrations are placed in src/main/resources/db/migration
Now I want to exclude sql resources from the target war so I add to my pom.xml:
<project>
...
<build>
...
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*.sql</exclude>
</excludes>
</resource>
</resources>
...
</build>
</project>
But then flyway doesn’t work because in grabs migrations from the target.
So how could I use flyway but avoid copying sql to my war?
My solution was to exclude files from copying to the target war instead of excluding the resources from copying to target classes. Here is the way to do it: