gpt4 book ai didi

java - Maven 部署抛出错误

转载 作者:行者123 更新时间:2023-11-30 07:28:38 27 4
gpt4 key购买 nike

我有一个非常简单/基本的网络应用程序。当我运行时

mvn deploy -e

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

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project TestWebApp: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project TestWebApp: Deployment failed: reposi tory element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at 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>

最佳答案

我通过将 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>

关于java - Maven 部署抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36476885/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com