当用户指定-DskipTests=true时,不希望运行maven依赖插件

Do not want to run maven-dependency-plugin when user specifies -DskipTests=true

本文关键字:希望 运行 maven 插件 依赖 用户 -DskipTests true      更新时间:2023-09-26

我们使用Jasmine Spec测试来测试我们的JS代码。为了运行规范,我们使用maven依赖插件从Nexus下载openui5依赖项,并将它们解压缩到我们的本地文件夹中。我们面临的问题是"zip"是巨大的,因此我们不希望在用户指定-DskipTests=true时运行这个"maven依赖插件"执行步骤。有没有办法指定相同的。我们的pom看起来像:

<groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
        <executions>
            <execution>
                <id>unpack-ui5</id>
                <phase>process-resources</phase>
                <goals>
                    <goal>unpack</goal>
                </goals>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                                <groupId>xxxxx</groupId>
                                <artifactId>xxxxxx</artifactId>
                                <version>xxxxxx</version>
                                <classifier>static</classifier>
                                <type>zip</type>
                                <overWrite>false</overWrite>
                                <outputDirectory>${project.build.directory}/dependency/openui5</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>

任何指针都会很棒。

依赖插件的解包目标上有一个跳过参数

您需要跳过项目属性,类似于以下内容:

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            ...
            <configuration>
               <skip>${skipTests}</skip>
               ... 
            </configuration>
        </execution>
    </executions>
</plugin>