将maven工件发布到文件上传servlet

时间:2011-11-23 15:26:19

标签: maven maven-deploy-plugin

我们有一个servlet,我们发布一个zip文件。我想自动构建zip并使用maven将其发布到servlet。有没有办法用maven插件做到这一点,还是我应该只使用外部工具或蚂蚁任务?

3 个答案:

答案 0 :(得分:2)

我们最终使用了一些蚂蚁/卷曲:

    <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>run</goal>
                </goals>
                <configuration>
                    <target>
                        <exec executable="curl">
                            <arg value="-F"/>
                            <arg value="file=@target/templates.zip"/>
                            <arg value="http://localhost:8080/template/process"/>
                        </exec>
                    </target>
                </configuration>
            </execution>
        </executions>
    </plugin>

答案 1 :(得分:0)

Maven assembly plugin应该有助于此用例。

答案 2 :(得分:0)

deploy plugin可以将您构建的zip工件转移到servlet。 deploy-file目标具有参数,您可以在其中明确设置要上传的网址。或者您可以在POM中设置distribution management section以标准方式执行此操作。