简体   繁体   English

MVN版本:执行DistributionManagement网址

[英]mvn release:perform distributionManagement url

I have this configuration in my pom.xml : 我的pom.xml有以下配置:

<distributionManagement>
        <downloadUrl>http://mydomain/downloads/<downloadUrl>
        <repository>
            <id>Id</id>
            <name>Name</name>
            <url>scp://ipaddress/downloads/</url>
        </repository>
    </distributionManagement>

When I do mvn release:perform and navigate to http://mydomain/downloads/ , there is a directory hierarchy com/my/application that is my app groupId and, inside that, I have the .apk file (is an Android app). 当我执行mvn release:perform并导航到http://mydomain/downloads/ ,有一个目录层次结构com/my/application是我的应用程序groupId,在其中,我有.apk文件(是一个Android应用程序)。

Is there any way to deploy the apk in http://mydomain/downloads/ instead of http://mydomain/downloads/com/my/application ? 有什么方法可以在http://mydomain/downloads/而不是http://mydomain/downloads/com/my/application部署apk? I mean, ignore the groupId. 我的意思是,忽略groupId。

Thanks! 谢谢!

You can't ignore the groupId cause this is the foundation on which a maven repository is based. 您不能忽略groupId,因为这是Maven存储库的基础。

If you like to do it in an other way than you shouldn't use deployment of Maven. 如果您希望以其他方式执行此操作,则不应使用Maven部署。 The solution can be to use a particular plugin like wagon-maven-plugin 解决方案可以是使用特定的插件,例如wagon-maven-plugin

Thanks to khmarbaise, I found the solution using wagon plugin: 感谢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>

Furthermore, I put <serverId> tag beacuse its credentials are stored in settings.xml . 此外,我放置<serverId>标记是因为其凭据存储在settings.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM