【问题标题】:Release plugin error - no POM in this directory发布插件错误 - 此目录中没有 POM
【发布时间】:2014-01-08 01:29:06
【问题描述】:

我正在尝试使用 maven 发布插件,但我遇到了阻止我使用它的错误。

我的文件夹结构:

+root
    +parent
        pom.xml
    +projectA
        pom.xml
    +projectB
        pom.xml
    pom.xml

根/父/pom.xml

<project ...>
    <groupId>org.acme</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>throttling</name>
    <url>http://maven.apache.org</url>

    ...

    <scm>
        <connection>scm:hg:https://code.google.com/***</connection>
    </scm>

    <distributionManagement>
        <repository>
            <id>deployment</id>
            ...
        </repository>
        <snapshotRepository>
            <id>deployment</id>
            ...
        </snapshotRepository>
    </distributionManagement>
</project>

root/pom.xml

<project ...>
    <artifactId>throttling-modules</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>throttling</name>
    <url>http://maven.apache.org</url>
    <parent>
        <groupId>org.acme</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath />
    </parent>

    <modules>
        <module>projectA</module>
        <module>projectB</module>
    </modules>

    <scm>
        <connection>scm:hg:https://code.google.com/***</connection>
    </scm>

    <distributionManagement>
        <repository>
            <id>deployment</id>
            ...
        </repository>
        <snapshotRepository>
            <id>deployment</id>
            ...
        </snapshotRepository>
    </distributionManagement>
</project>

root/projectA/pom.xml

<project ...>
    <parent>
        <groupId>org.acme</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath />
    </parent>
    <artifactId>thr-common</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>thr-common</name>
    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    ...
</project>

我执行了运行良好的命令“mvn release:prepare”。

之后我执行了 'mvn release:perform' 但我收到了下一条错误消息 (mvn release:perform -Dusername=???? -Dpassword=????? -DconnectionUrl=scm:hg:https://code.google.com/???):

[INFO] Checking out the project to perform the release ...
[INFO] Removing D:\work\throttling\code_google\***\throttling\parent\target\checkout
[INFO] EXECUTING: cmd.exe /X /C "hg clone -r release_parent-1.1 https://***:***@code.google.com/*** D:\work\throttling\code_google\***\throttling\parent\target\checkout"
[INFO] EXECUTING: cmd.exe /X /C "hg locate"
[INFO] Executing goals 'deploy'...
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] [INFO] Scanning for projects...
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (D:\work\throttling\code_google\***\throttling\parent\target\checkout). Please verify you invoked Maven from the correct directory. -> [Help 1]

throttling\parent\target 中的文件夹结构

+throttling\parent\target
    +checkout
        +throttling
            +parent
            +projectA
            +projectB

谢谢, 五、

【问题讨论】:

  • 你在根文件夹中运行 mvn release:perform 对吗?
  • 嗨 emelendez,我假设首先我必须将父项目发布到非快照版本,然后我可以发布其余项目。还是我弄错了?谢谢,V。
  • 我需要知道哪个 pom.xml(根或父)在 xml 中有模块部分。你能确认一下吗?
  • 嗨,emendelez,再次感谢!模块部分位于 root/pom.xml 中。五、
  • 感谢提供信息,首先你需要删除 -SNAPSHOT 然后在根项目中运行 mvn release:perform

标签: maven release


【解决方案1】:

我最终可以解决问题,父pom的路径必须在父pom XML中定义。

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.4.2</version>
            <executions>
                <execution>
                    <id>default</id>
                    <goals>
                        <goal>perform</goal>
                    </goals>
                    <configuration>
                        <pomFileName>parent/pom.xml</pomFileName>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

【讨论】:

  • 这很好用……但是为什么呢?我的 pom 文件名与此配置中的内容不匹配。经过数小时尝试解决此问题(使用非标准 pom 位置/名称),这是唯一有效的方法(使用此配置,如上所示)
  • 嗨,Noremac,实际上我无法回答,我觉得为什么必须设置父 pom 的路径很奇怪。我也很好奇答案是什么。
  • 另一个问题,你是怎么得到这个特定配置的?您是否在某个网站上找到了它?
  • 幸运的是 google.com 非常友好并帮助了我 :) 实际上我不知道我在哪里找到了这些信息,但我真的很高兴......
猜你喜欢
  • 1970-01-01
  • 2012-12-02
  • 2015-02-13
  • 2016-02-26
  • 2013-09-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-28
相关资源
最近更新 更多