我正在尝试运行该命令mvn release:perform,但是我收到此错误:
Run Code Online (Sandbox Code Playgroud)Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project git-demo: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
这是我的pom.xml档案:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sonatype.blog</groupId>
<artifactId>git-demo</artifactId>
<packaging>jar</packaging>
<version>1.1-SNAPSHOT</version>
<name>git-demo</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<scm>
<connection>scm:git:git@github.com:Christian-Achilli-KP/git-demo.git</connection>
<url>scm:git:git@github.com:Christian-Achilli-KP/git-demo.git</url>
<developerConnection>scm:git:git@github.com:Christian-Achilli-KP/git-demo.git</developerConnection>
</scm>
<distributionManagement>
<!-- use the following if you're not using a snapshot version. -->
<repository>
<id>localSnap</id>
<name>RepositoryProxyRel</name>
<url>http://127.0.0.1:8080/nexus/content/repositories/releases/</url>
</repository>
<!-- use the following if you ARE using a snapshot version. -->
<snapshotRepository>
<id>MylocalSnap</id>
<name>RepositoryProxySnap</name>
<url>http://127.0.0.1:8080/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
其实我可以看到
知识库
里面的宣言
distributionManagent
标签.
这是我的settings.xml:
<settings>
<servers>
<server>
<id>localSnap</id>
<username>deployment</username>
<password>****</password>
</server>
<server>
<id>MylocalSnap</id>
<username>deployment</username>
<password>****</password>
</server>
<server>
<id>myserver</id>
<username>tomcat</username>
<password>tomcat</password>
</server>
</servers>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://127.0.0.1:8080/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<properties>
<project.build.sourceEncoding>MacRoman</project.build.sourceEncoding>
<project.reporting.outputEncoding>MacRoman</project.reporting.outputEncoding>
</properties>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
Run Code Online (Sandbox Code Playgroud)
有什么建议为什么抱怨?
maz*_*azi 10
我得到了相同的消息("未在分配管理元素中的POM中指定存储库元素").我检查了/target/checkout/pom.xml,并按照另一个答案,它确实缺乏<distributionManagement>.
事实证明,<distributionManagement>我的主分支中的pom.xml中缺少问题(使用git).
清理后(mvn release:rollback,mvn clean,mvn release:clean,git tag -d v1.0.0)我跑mvn release再次和它的工作.
您还可以在命令行上覆盖部署存储库:
-Darguments=-DaltDeploymentRepository=myreposid::default::http://my/url/releases
两个仓库的ID都是localSnap;这可能不是您想要的,并且可能会让 Maven 感到困惑。
如果不是这样:repository您的 POM 中可能有更多元素。mvn help:effective-pom搜索for的输出repository以确保它们的数量和位置符合您的预期。
| 归档时间: |
|
| 查看次数: |
106813 次 |
| 最近记录: |