在maven-dependency-plugin中如何在我传递参数时解压缩?

时间:2015-07-02 07:59:43

标签: maven pom.xml maven-dependency-plugin

有人知道如何按术语解压缩工件吗?

意思是给他一个布尔参数,它将决定是否解压缩某个神器。

我尝试使用跳过标记,但它不起作用。

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.9</version>
                <executions>
                  <execution>
                    <id>get-rpm</id>
                    <phase>compile</phase>
                    <goals>
                      <goal>copy</goal>
                    </goals>
                    <configuration>
                      <artifactItems>
                        <artifactItem>
                          <groupId>com.XX.XXX</groupId>
                          <artifactId>XXX-ONPREM</artifactId>
                          <version>${BUILD_NUMBER}</version>
                          <type>rpm</type>
                          <classifier>rpm</classifier>
                          <overWrite>true</overWrite>
                          <outputDirectory>${project.build.directory}</outputDirectory>
                          <destFileName>${PACKAGE_NAME}</destFileName>
                        </artifactItem>
                      </artifactItems>
                      <!-- other configurations here -->
                    </configuration>
                  </execution>
                  <execution>
                    <id>get-third-parties</id>
                    <phase>compile</phase>
                    <goals>
                      <goal>unpack</goal>
                    </goals>
                    <configuration>
                      <artifactItems>
                        <artifactItem>
                          <groupId>com.XX.XXX</groupId>
                          <artifactId>thirdparties-sources</artifactId>
                          <version>${third-parties.version}</version>
                          <type>zip</type>
                          <skip>true</skip>
                          <overWrite>true</overWrite>
                          <outputDirectory>${project.build.directory}/3rd-parties</outputDirectory>
                        </artifactItem>
                      </artifactItems>
                      <!-- other configurations here -->
                    </configuration>
                  </execution>

1 个答案:

答案 0 :(得分:0)

所以我明白了, 您只需将跳过标记放在正确的位置, 我在配置完成后就把它做好了。

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.9</version>
                <executions>
                  <execution>
                    <id>get-rpm</id>
                    <phase>compile</phase>
                    <goals>
                      <goal>copy</goal>
                    </goals>
                    <configuration>
                      <artifactItems>
                        <artifactItem>
                          <groupId>com.XX.XXX</groupId>
                          <artifactId>AGM-ONPREM</artifactId>
                          <version>${BUILD_NUMBER}</version>
                          <type>rpm</type>
                          <classifier>rpm</classifier>
                          <overWrite>true</overWrite>
                          <outputDirectory>${project.build.directory}</outputDirectory>
                          <destFileName>${PACKAGE_NAME}</destFileName>
                        </artifactItem>
                      </artifactItems>
                      <!-- other configurations here -->
                    </configuration>
                  </execution>
                  <execution>
                    <id>get-third-parties</id>
                    <phase>compile</phase>
                    <goals>
                      <goal>unpack</goal>
                    </goals>
                    <configuration>
                      <skip>${SKIP_3rd}</skip>
                      <artifactItems>
                        <artifactItem>
                          <groupId>com.XX.XXX</groupId>
                          <artifactId>thirdparties-sources</artifactId>
                          <version>${third-parties.version}</version>
                          <type>zip</type>
                          <overWrite>true</overWrite>
                          <outputDirectory>${project.build.directory}/3rd-parties</outputDirectory>
                        </artifactItem>
                      </artifactItems>
                      <!-- other configurations here -->
                    </configuration>
                  </execution>