I'm using the Build Helper Maven plugin to attach the SQL changes as an artifact of the deployment, but the plugin crashes when the extra artifact is not present.
Failed to install artifact org.test.app1:app1:sql:1.2.1: app1/src/main/database-source/1.2.1/dba.sql (No such file or directory) -> [Help 1]
The SQL file is present for most app versions, but not on all of them, since minor app versions may not include SQL changes. The directory structure for the SQL files includes their versions separately as shown below:
src/
main/
database-source/
1.0.0/
dba.sql
1.2.0/
dba.sql
1.2.1/
-- no "dba.sql" file here since there aren't SQL changes in this version
1.3.0/
dba.sql
The Build Helper plugin configuration I'm using is:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>src/main/database-source/${project.version}/dba.sql</file>
<type>sql</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
I read about the <skipAttach>
tag, but don't understand how to use it.
How can I silently skip the extra artifact when the file is not present (as in version 1.2.1 above)?