繁体   English   中英

马文。 运行测试时跳过插件执行

[英]Maven. Skip plugin execution when running tests

在我的pom.xml我有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>

运行它需要一些时间,我运行测试时不需要这个插件。

运行mvn test时是否可以不执行插件?

frontend-maven-plugin 现在具有禁用特定目标执行的特定键 例如,添加系统属性skip.npm将跳过npm 执行。 您可以在以这种方式运行 maven 时添加它:

mvn test -Dskip.npm

你听说过 Maven 配置文件吗? http://maven.apache.org/guides/introduction/introduction-to-profiles.html

我知道当你想测试一个包时,你不想构建一个更大的包。

您可以定义一个配置文件来准确选择要构建和测试的模块。

你有一个相关的问题:

使用特定配置文件时禁用 Maven 插件

如果它对您有帮助,请告诉我们!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM