9

In my pom.xml I have frontend-maven-plugin.

<plugin>
    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>1.4</version>

    <configuration>
        <nodeVersion>v6.11.0</nodeVersion>
        <npmVersion>3.10.10</npmVersion>
        <workingDirectory>src/main/frontend</workingDirectory>
    </configuration>

    <executions>
        <execution>
            <id>install node and npm</id>
            <goals>
                <goal>install-node-and-npm</goal>
            </goals>
        </execution>
        <execution>
            <id>npm install</id>
            <goals>
                <goal>npm</goal>
            </goals>
        <execution>
        <execution>
            <id>npm run build</id>
            <goals>
                <goal>npm</goal>
            </goals>

            <configuration>
                <arguments>run build</arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

It takes some time to run it and don't need this plugin when I run tests.

Is it possible to not execute the plugin when I run mvn test?

2 Answers 2

24

The frontend-maven-plugin now has specific keys to disable execution of particular goals. For example, adding system property skip.npm will skip npm execution. You can add it when running maven this way:

mvn test -Dskip.npm
1
  • This does not seem to work if the <execution> in the POM has defined <skip>false</skip> in its <configuration> :-(
    – msa
    Jun 24, 2021 at 18:18
2

did you heard about maven profile? http://maven.apache.org/guides/introduction/introduction-to-profiles.html

I understand that when you want to test a package, you don't want to build a bigger one.

You could define a profile that choose exactly what module you want to build and test.

You have a related question there:

Disable maven plugins when using a specific profile

Let us know if it helped you!

1
  • yes, sure I've heard about maven profiles. Just wondering if there's an easier way to do this.
    – htshame
    Apr 22, 2018 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.