首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Maven:在distributionManagement内部的POM中未指定存储库元素?

Maven:在distributionManagement内部的POM中未指定存储库元素?
EN

Stack Overflow用户
提问于 2011-05-06 18:24:39
回答 5查看 113.2K关注 0票数 75

我正在尝试运行命令mvn release:perform,但是我得到了这个错误:

无法在项目git-demo上执行目标org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (默认部署):部署失败:未在distributionManagement元素内部的POM或-DaltDeploymentRepository=id::layout::url参数中指定存储库元素

这是我的pom.xml文件:

代码语言:javascript
复制
<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>

实际上我可以看到

存储库

中的声明。

distributionManagent

标签。

这是我的settings.xml

代码语言:javascript
复制
<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>

有什么建议为什么它会抱怨吗?

EN

回答 5

Stack Overflow用户

发布于 2012-11-10 03:10:31

查看target/checkout/中的pom.xml文件。您的中继或主分支中的pom.xml很可能没有distributionManagement标记。

票数 40
EN

Stack Overflow用户

发布于 2013-03-31 22:27:17

我得到了相同的消息(“在distributionManagement元素内的POM中没有指定存储库元素”)。我检查了/target/checkout/pom.xml,根据另一个答案,它确实缺少<distributionManagement>

原来问题是<distributionManagement>在我的主分支(使用git)的pom.xml中丢失了。

在清理(mvn release:rollbackmvn cleanmvn release:cleangit tag -d v1.0.0)之后,我再次运行mvn release,它起作用了。

票数 11
EN

Stack Overflow用户

发布于 2013-05-01 19:16:24

您还可以在命令行上覆盖部署存储库:-Darguments=-DaltDeploymentRepository=myreposid::default::http://my/url/releases

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5910037

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档