Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse and Maven: Run goal after a file is changed

I have a maven goal configured in the pom that is executed on compile phase. But also I need that goal to run after a specific file is changed to keep everything always up to date.

i.e I want to save the file "objects.xml" and run the goal "transform" to apply XSL every time a change is done.

Is there a way for doing that from inside Eclipse?

I've been reading about custom builders for the project, but that does not cover my case.

like image 407
MRz Avatar asked Jan 21 '11 14:01

MRz


1 Answers

You can add builders and custom ant scripts to your eclipse workspace.

Project->Preferences->Builders

These builders can be automatically be added to you project with

mvn eclipse:eclipse

By adding the folling config to your pom

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <configuration>
                <additionalBuildcommands>
                    <buildcommand>your.custom.Builder</buildcommand>
                </additionalBuildcommands>

for more info how to do this see the maven-eclipse-plugin website

http://maven.apache.org/plugins/maven-eclipse-plugin/

like image 79
Mark Bakker Avatar answered Nov 04 '22 19:11

Mark Bakker