Search code examples
mavenmaven-pluginpom.xmlexec-maven-pluginmaven-resources-plugin

Maven exec-maven-plugin and maven-resources-plugin not running, not sure why


I have added a couple of new plugins to a maven pom.xml file.

I have not been able to figure out why exec-maven-plugin and maven-resources-plugin they aren't running when I issue the command: mvn install. The other maven plugins do execute as expected.

When I run mvn exec:exec, exec-maven-plugin does indeed get run.

I have tried using a number of different phases, to no avail.

What am I doing wrong here, and what should I try?


Here is the relevant section of my maven file

<plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <executions>
            <execution>
                <id>build-spa-bower</id>
                <phase>validate</phase>
                <configuration>
                    <executable>bower</executable>
                    <arguments>install</arguments>
                    <workingDirectory>src/main/spa</workingDirectory>
                </configuration>
            </execution>
            <execution>
                <id>build-spa-grunt</id>
                <phase>validate</phase>
                <configuration>
                    <executable>bower</executable>
                    <arguments>install</arguments>
                    <workingDirectory>src/main/spa</workingDirectory>
                </configuration>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
            <execution>
                <id>resource-spa</id>
                <phase>compile</phase>
                <configuration>
                    <outputDirectory>${project.groupId}/${project.artifactId}/spa</outputDirectory>
                    <resources>
                        <directory>src/main/spa/dist</directory>
                        <filtering>false</filtering>
                    </resources>
                </configuration>
            </execution>
        </executions>
    </plugin>
    <!-- ... -->
</plugins>

EDIT:

found answer for exec plugin, but not yet for resources plugin.

The exec plugin requires a goal in order to trigger

adding <goals><goal>exec</goal></goals> to each <execution> did the trick for me.


Solution

  • If you put your configuration in an <execution/> you need to specify which goals need to run in this execution.

    For plugins that are linked to a phase by default, you can also specify the configuration outside the <executions/> and that configuration will be used during the default phases of that plugin.