2011-03-01 90 views
0

嗨 我已經想通了怎麼做才能在我的項目目錄中分解一個zip文件 但是我想只做一次。我的意思是,如果指揮官已經存在,不會再次爆炸。 這是我今天做用maven依賴插件解壓依賴一次

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

感謝您的幫助

回答

1

我會建議使用配置文件來檢查,如果該文件夾存在的方式。但我會建議把該文件夾放到不同的文件夾,例如目標文件夾....

<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> 
+0

是的。不要把它放在目標目錄中,因爲在每個'mvn clean'過程中都會被刪除,所以你最終會將qooxdoo解壓縮得超出你的需要。 – 2011-03-02 12:52:54