Problem uploading with maven-wagon-plugin

风格不统一 提交于 2019-12-21 17:10:11

问题


Im having a strange problem when im trying to let the wagon plugin upload files during the site-deploy lifecycle when i'm invoking the release:perform goal. It seems wagon uploads the files correctly when im invoking mvn site-deploy but it just responds with

Nothing to upload

when calling mvn release:perform which is supposed to invoke the phases site site-deploy as stated in the documentation.

this is the plugin config for wagon.

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>1.0-beta-3</version>
            <executions>
                <execution>
                    <id>upload-jars</id>
                    <phase>deploy site-deploy</phase>
                    <goals>
                        <goal>upload</goal>
                    </goals>
                    <configuration>
                        <fromDir>target/checkout/target</fromDir>
                        <includes>*.jar</includes>
                        <url>scpexe://nohost.com</url>
                        <toDir>/var/www/projects/test</toDir>
                        <serverId>server - projects</serverId>
                    </configuration>
                </execution>
            </executions>
        </plugin>

maven tells me the right goals were started:

[INFO] Executing goals 'deploy site-deploy'...
[INFO] [INFO] Scanning for projects...

but wagon doesn't upload anything:

[INFO] [INFO] --- wagon-maven-plugin:1.0-beta-3:upload (default) @ exp4j ---
[INFO] [INFO] Nothing to upload.
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS

Does anyone spot my problem that causes maven to work as expected when invoking site-deploy but failing when doing a release:perform ?


回答1:


This plugin does not do what you think it does. Trust me, I've been there.

The underlying wagon protocol is only intended for talking to Maven Repositories, not arbitrary directories. If the stuff you are pushing doesn't have files and directories in the pattern of a repo, the plugin will decide that there's nothing for it to do.

I spent hours and hours and hours on this, and read the code, and reached the conclusion that this plugin is not intended to be useful for pushing arbitrary files to arbitrary places, and in fact does not work for that purpose.




回答2:


I had the same issue until I've found at that the "includes" tag must contains "/*" to recursively include files and subdirectories. See comments of that blog post

<includes>*/**</includes>


来源:https://stackoverflow.com/questions/5493522/problem-uploading-with-maven-wagon-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!