danb
danb

Reputation: 10379

post maven artifact to file upload servlet

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?

Upvotes: 2

Views: 875

Answers (3)

danb
danb

Reputation: 10379

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>

Upvotes: 2

prunge
prunge

Reputation: 23238

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.

Upvotes: 0

Sri Sankaran
Sri Sankaran

Reputation: 8310

The Maven assembly plugin should help with this use case.

Upvotes: 0

Related Questions