Maven部署插件无法正常工作

时间:2017-02-17 07:30:34

标签: java maven-3 parent-pom

我的pom.xml中有一个以下配置,我想使用maven deploy plugin目标进行部署。

        <plugin>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.5</version>
            <executions>
                <execution>
                    <id>deploy-file</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy-file</goal>
                    </goals>
                    <configuration>
                        <groupId>com.my.build</groupId>
                        <artifactId>my_build</artifactId>
                        <version>${version}</version>
                        <packaging>zip</packaging>
                        <generatePom>true</generatePom>
                        <repositoryId>dsnexus</repositoryId>
                        <url>https://dsnexus.xxxcontent/repositories/releases</url>
                        <file>target/my_build-${version}.zip</file>
                    </configuration>
                </execution>
            </executions>
        </plugin>

<distributionManagement>
    <repository>
        <id>dsnexus</id>
        <name>Repo</name>
        <url>
            https://dsnexus.xxxcontent/repositories/releases
        </url>
    </repository>
</distributionManagement>

我尝试使用以下命令及其工作 -

     mvn deploy:deploy-file -Dfile=target/my_build-1.5.5.zip -DrepositoryId=dsnexus -Durl=https://dsnexus.xxxcontent/repositories/releases
         -DgroupId=com.my.build -DartifactId=my_build -Dversion=1.5.5 -Dpackaging=zip

但是当我跑到失败之下时。我想部署zip而不指定上面的完整信息 -

     mvn deploy:deploy-file

  Error:
        Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'file', 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file are missing or invalid
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:576)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:529)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:2)

如果未指定某些信息,则

mvn deploy:deploy-file会失败,正如此页面上的官方文档所示:mvn deploy-file