Have a look at the integration tests for some ideas.
The execution of this plugin's goal can be bound to a phase of the build lifecycle, in this example the test phase.
<project>
[...]
<build>
[...]
<plugins>
[...]
<plugin>
<groupId>com.github.genthaler</groupId>
<artifactId>beanshell-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<script><![CDATA[
import org.codehaus.plexus.util.FileUtils;
FileUtils.fileWrite( "touched.txt", "This is a Beanshell Maven Plugin POM test" );
]]></script>
</configuration>
</execution>
<execution>
[...]
</execution>
[...]
</executions>
</plugin>
[...]
</plugins>
[...]
</build>
[...]
</project>