mvn release:执行distributionManagement url

时间:2015-02-04 15:41:57

标签: maven deployment maven-release-plugin

我在pom.xml

中有此配置
<distributionManagement>
        <downloadUrl>http://mydomain/downloads/<downloadUrl>
        <repository>
            <id>Id</id>
            <name>Name</name>
            <url>scp://ipaddress/downloads/</url>
        </repository>
    </distributionManagement>

当我执行mvn release:perform并导航到http://mydomain/downloads/时,有一个目录层次结构com/my/application,它是我的app groupId,在其中,我有.apk文件(是Android版)应用程序)。

有没有办法在http://mydomain/downloads/而不是http://mydomain/downloads/com/my/application部署apk?我的意思是,忽略groupId。

谢谢!

2 个答案:

答案 0 :(得分:1)

您不能忽略groupId,因为这是maven存储库所基于的基础。

如果您希望以其他方式执行此操作,则不应使用Maven的部署。解决方案可以是使用特定的插件,如wagon-maven-plugin

答案 1 :(得分:1)

感谢khmarbaise,我找到了使用wagon插件的解决方案:

<build>
...
 <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>2.8</version>
            </extension>
        </extensions>
...

    <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>wagon-maven-plugin</artifactId>
                    <version>1.0</version>
                    <executions>
                        <execution>
                            <id>upload-apk</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>upload</goal>
                            </goals>
                            <configuration>
                                <fromDir>${project.build.directory}</fromDir>
                                <includes>${project.build.finalName}.apk</includes>
                                <url>scp://ipaddress/downloads/${artifactId}</url>
                                <serverId>downloads</serverId>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
    </plugins>

    </build>

此外,我将<serverId>标记用于settings.xml存储其凭据。