Pergunta

We have a servlet that we post a zip file to. I would like to automate building the zip and posting it to the servlet with maven. Is there a way to do that with maven plugins or should I just use external tools or ant tasks?

Foi útil?

Solução

We ended up using some ant/curl:

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

Outras dicas

The Maven assembly plugin should help with this use case.

The deploy plugin can transfer your built zip artifact to the servlet. The deploy-file goal has parameters where you can explicitly set the URL to upload to. Or you can set up the distribution management section in the POM to do it the standard way.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top