使用 Maven dependentecy 插件解压一次依赖项

发布于 2024-10-19 13:33:15 字数 2221 浏览 3 评论 0原文

你好 我已经弄清楚如何在我的项目目录中分解 zip 文件 但我只想做一次。我的意思是,如果目录已经存在,就不要再次爆炸它。 这就是我今天的做法,

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <!--Import qooxdoo sdk and add it to target directory-->
                    <execution>
                        <id>extract-qooxdoo-sdk</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>qooxdoo-sdk</includeArtifactIds>
                            <outputDirectory>${project.basedir}/qooxdoo-sdk</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>>2.2</version>
                <executions>
                    <!--Import qooxdoo sdk and add it to target directory-->
                    <execution>
                        <id>extract-qooxdoo-sdk</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>qooxdoo-sdk</includeArtifactIds>
                            <outputDirectory>${project.basedir}/qooxdoo-sdk</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

感谢您的帮助

Hi
i've figured out what to do to explode a zip file in my project directory
But i would like to do it just one time. i mean if the diretory already exist not explode it a second time.
Here is the way i do it today

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <!--Import qooxdoo sdk and add it to target directory-->
                    <execution>
                        <id>extract-qooxdoo-sdk</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>qooxdoo-sdk</includeArtifactIds>
                            <outputDirectory>${project.basedir}/qooxdoo-sdk</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>>2.2</version>
                <executions>
                    <!--Import qooxdoo sdk and add it to target directory-->
                    <execution>
                        <id>extract-qooxdoo-sdk</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>qooxdoo-sdk</includeArtifactIds>
                            <outputDirectory>${project.basedir}/qooxdoo-sdk</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

thanks for your help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岛徒 2024-10-26 13:33:15

我建议使用配置文件来检查该文件夹是否存在。但我建议将该文件夹放入不同的文件夹中,例如目标文件夹......

<profiles>
  <profile>
    <id>qo</id>
    <activation>
      <file>
        <missing>${project.basedir}/qooxdoo-sdk</missing>
      </file>
    </activation>
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.2</version>
          <executions>
            <!--Import qooxdoo sdk and add it to target directory-->
            <execution>
              <id>extract-qooxdoo-sdk</id>
              <phase>process-resources</phase>
              <goals>
                <goal>unpack-dependencies</goal>
              </goals>
              <configuration>
                <includeArtifactIds>qooxdoo-sdk</includeArtifactIds>
                <outputDirectory>${project.basedir}/qooxdoo-sdk</outputDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>

i would suggest to use a profile to check if the folder exists. But i would suggest to put that folder into a different folder for example to target folder....

<profiles>
  <profile>
    <id>qo</id>
    <activation>
      <file>
        <missing>${project.basedir}/qooxdoo-sdk</missing>
      </file>
    </activation>
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.2</version>
          <executions>
            <!--Import qooxdoo sdk and add it to target directory-->
            <execution>
              <id>extract-qooxdoo-sdk</id>
              <phase>process-resources</phase>
              <goals>
                <goal>unpack-dependencies</goal>
              </goals>
              <configuration>
                <includeArtifactIds>qooxdoo-sdk</includeArtifactIds>
                <outputDirectory>${project.basedir}/qooxdoo-sdk</outputDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文