簡體   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