开发者

Pom.xml - tar task

Is it possible to add a task to the pom.xml file that 开发者_JAVA技巧will create a tar.gz / .zip file.

for eample:

<tar type="tar.gz" source="resources/sql" tofile="target/sql.tar.gz"/>

Thanks


Use the maven-assembly-plugin

Create a src/main/assembly/bin.xml as detailed at http://maven.apache.org/plugin-developers/cookbook/generate-assembly.html and http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#bin

Put your resources sql files in the includes and give the format of output as tar.gz

Next, in your pom.xml put the reference to this plugin

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.2-beta-5</version>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/bin.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
            </phase>              
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

http://maven.apache.org/plugins/maven-assembly-plugin/usage.html

Last, call this using

mvn package
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜