I googled a bit and found this snippet:
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.1</version>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Generate-shared-lib</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bash</executable>
<arguments>
<argument>generate-lib.sh</argument>
</arguments>
<environmentVariables>
<JAVA_HOME>${env.JAVA_HOME}</JAVA_HOME>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
At least with certain plug-ins Maven will execute arbitrary commands at build time. And if you need that to build native bindings it feels like a big hole. Granted, most projects don't need JNI, I guess.