【问题标题】:Maven deploy is throwing errorMaven 部署抛出错误
【发布时间】:2016-07-28 09:02:01
【问题描述】:

我有一个非常简单/基本的 Web 应用程序。 当我跑步时

mvn 部署 -e

我在控制台中看到以下错误。

[ERROR] 未能执行目标 org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy 项目 TestWebApp 上的(默认部署):部署失败:存储库 未在 distributionManagement 内的 POM 中指定元素 元素或 -DaltDeploymentRepository=id::layout::url 参数 -> [帮助1] org.apache.maven.lifecycle.LifecycleExecutionException: 未能执行目标 org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy 项目 TestWebApp 上的(默认部署):部署失败:存储库 未在 distributionManagement 内的 POM 中指定元素 元素或 -DaltDeploymentRepository=id::layout::url 参数 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

Maven 部分是:

<profile>
        <id>TestWebApp-Repo</id>
            <repositories>
                <distributionManagement>
                    <repository>
                      <id>TestWebApp_Repository</id>
                      <name>TestWebApp Applications Repository Internal</name>
                      <url>C:/Users/~/.m2/repository</url>
                      <releases>
                        <enabled>true</enabled>
                      </releases>
                      <snapshots>
                        <enabled>false</enabled>
                      </snapshots>
                    </repository>
                </distributionManagement>
            </repositories>
</profile>

【问题讨论】:

  • 你能用-X标志运行命令吗
  • 也做一个项目> 清理然后使用 -X 运行命令(用于详细日志记录)
  • 检查这个类似的问题stackoverflow.com/questions/5910037/…
  • DistributionManagement 不属于 repositories maven.apache.org/pom.html#Distribution_Management
  • 我在使用 -X 标志运行时看到以下错误:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy ) 在 TestWebApp 项目上:部署失败:没有在 POM 中的 distributionManagement 元素或 -DaltDeploymentRepository=id::layout::url 参数中指定存储库元素 -> [帮助 1]

标签: java maven deployment


【解决方案1】:

我通过将 distributionManagement 移动到 pom 文件中并将 URL 更改为使用文件来解决此问题。链接http://maven.apache.org/wagon/index.html 非常有帮助。我的解决方案如下:

<distributionManagement>
    <repository>
      <uniqueVersion>false</uniqueVersion>
      <id>TestWebApp_Repository</id>
      <name>TestWebApp Applications Repository Internal</name>
      <url>file://C:/Users/user/.m2/repository</url>
      <layout>default</layout>
    </repository>
    <snapshotRepository>
      <uniqueVersion>false</uniqueVersion>
      <id>TestWebApp_Repository</id>
      <name>TestWebApp Applications Repository Internal</name>
      <url>file://C:/Users/user/.m2/repository</url>
      <layout>default</layout>
    </snapshotRepository>
  </distributionManagement>

【讨论】:

    【解决方案2】:

    尝试激活个人资料TestWebApp-Repo

    mvn -e -PTestWebApp-Repo deploy

    或者在&lt;profile&gt;的末尾插入这个sn-p:

        <activation>
              <activeByDefault>true</activeByDefault>
        </activation>
    

    【讨论】:

      猜你喜欢
      • 2020-12-18
      • 1970-01-01
      • 2018-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-21
      相关资源
      最近更新 更多