문제

I try to use the Mave-Wagon plugin to download a file via HTTP-GET:

    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-http</artifactId>
        </extension>
    </extensions>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>1.0-beta-3</version>
            <executions>
                <execution>
                    <id>download-zip</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>download-single</goal>
                    </goals>
                    <configuration>
                        <url>http://server.com/Download/</url>
                        <fromFile>FileDownload.aspx?param=asdf&amp;param2=1234</fromFile>
                        <toDir>${project.build.directory}</toDir>
                        <toFile>targetfilename.zip</toFile>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

The problem is the ? in the target filename as the toFile is applied only after the download happened.

When I download the URL via a normal browser, the browser gives me also a "clean" and nice file name. Is this HTTP-Header ignored by Wagon-HTTP?

Is there any way to pass the parameters to the URL or make Maven to use another/cleaned file name?

For completeness, the whole exception is

    Caused by: java.io.FileNotFoundException: Illegal Syntax in filename (sorry this is an translation)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
    at org.apache.maven.wagon.LazyFileOutputStream.initialize(LazyFileOutputStream.java:154)
    at org.apache.maven.wagon.LazyFileOutputStream.write(LazyFileOutputStream.java:126)
    at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:492)
    at org.apache.maven.wagon.AbstractWagon.getTransfer(AbstractWagon.java:328)
    ... 25 more
도움이 되었습니까?

해결책

The Wagon plugin exposes the Wagon API, and the Wagon API is not a general purpose remote file system access API. It's intended only to push content in and out of Maven repositories, not arbitrary files to arbitrary places. I'd recommend using the maven-antrun-plugin and ssh as in this example.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top