发布插件错误 - 此目录中没有POM

时间:2013-12-19 12:57:13

标签: maven release

我正在尝试使用maven release插件,但是我遇到了一个错误,导致我无法使用它。

我的文件夹结构:

+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>

根/ 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>

根/了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]

限制\ parent \ target

中的文件夹结构
+throttling\parent\target
    +checkout
        +throttling
            +parent
            +projectA
            +projectB

谢谢, 诉

1 个答案:

答案 0 :(得分:1)

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

<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>