Hi Rogrigo, Rodrigo Madera wrote: > I was wondering if anyone has a suggestion on the best practice to > execute post-build scripts, such as copying output files to a > template directory for installer generation. > > Right now I'm using a shell script to do the copying and calling my > installer-generating scripts, but I'm sure there is another (and less > painful) way of doing this.
I don't know about best practices, but you could automate these tasks with Maven 2 by binding plugin executions to the phase you use to build. For example, if you run the lifecycle through the "package" phase (i.e., "mvn package" is how you perform your build), you could bind an antrun plugin[1] execution for the copying[2], and exec plugin[3] execution(s) to invoke the installer generation script(s). Something like (caveat: untested): <build> ... <plugins> ... <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>copy-files-for-installer-generation</id> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <copy todir="${project.build.dir}/installer"> <fileset dir="${project.build.dir}"> <includes> <include>${artifactId}-${version}.jar</include> ... </includes> </fileset> </copy> ... </tasks> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <id>call-first-installer-generator-script</id> <phase>package</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable> /path/to/first/installer/generator/script </executable> <workingDirectory> ${project.build.directory}/installer </workingDirectory> <arguments> <argument>...</argument> ... </arguments> </configuration> </execution> <execution> <id>call-second-installer-generator-script</id> <phase>package</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable> /path/to/second/installer/generator/script </executable> ... </configuration> </execution> ... </executions> </plugin> ... </plugins> ... </build> Steve [1] http://maven.apache.org/plugins/maven-antrun-plugin/ [2] http://ant.apache.org/manual/CoreTasks/copy.html [3] http://mojo.codehaus.org/exec-maven-plugin/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]