简体   繁体   English

maven - 由于未发布的依赖项而无法发布项目

[英]maven - Can't release project due to non released dependencies

I am using a multi-module pom setup and when using the release plugin I am unable to do so. 我正在使用多模块pom设置,当使用发布插件时,我无法这样做。 I get the error: 我收到错误:

Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project libraryparent: Can't release project due to non released dependencies :
com.xyz:libraryparent:pom:1.1-SNAPSHOT
in project 'utils' (com.xyz:utils:jar:1.1-SNAPSHOT)

the command I runs is: 我运行的命令是:

mvn -B release:clean release:prepare release:perform -DdryRun=true -DdevelopmentVersion=1.2-SNAPSHOT -DreleaseVersion=1.1

Here is the major portions of the files that I think is relevant: 以下是我认为相关文件的主要部分:

libraryparent libraryparent

<modelVersion>4.0.0</modelVersion>
  <groupId>com.xyz</groupId>
  <artifactId>libraryparent</artifactId>
  <version>1.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>parent library</name>
  <description>A parent pom for all library modules</description>

    <modules>
        <module>../util</module>
        <module>../streams</module>
    </modules>

  <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5</version>
        <configuration>
            <releaseProfiles>release</releaseProfiles>
            <goals>deploy assembly:single</goals>
            <!--
            <autoVersionSubmodules>true</autoVersionSubmodules>
            -->
        </configuration>
    </plugin>

util UTIL

<project .....>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>util</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>com.xyz</groupId> 
        <artifactId>libraryparent</artifactId> 
        <relativePath>../libraryparent/pom.xml</relativePath>
        <version>1.1-SNAPSHOT</version> 
    </parent>
</project>

streams

<project .....>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>streams</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>com.xyz</groupId>
        <artifactId>libraryparent</artifactId> 
        <relativePath>../libraryparent/pom.xml</relativePath>
        <version>1.1-SNAPSHOT</version>
    </parent>

    <dependencies>

        <dependency>
            <groupId>com.xyz</groupId>
            <artifactId>util</artifactId>
            <version>1.1-SNAPSHOT</version>
            <!--
            <version>${project.parent.version}</version>
            -->
            <classifier>j2me</classifier>
            <optional>true</optional>
        </dependency>

    </dependencies>

</project>

I would suspect that the release plugin can set the versions to their release versions,etc. 我怀疑发布插件可以将版本设置为发布版本等。

Thanks. 谢谢。

The maven-release-plugin verifies if the parent and dependencies are part of the multimodule project. maven-release-plugin验证父项和依赖项是否是多​​模块项目的一部分。 If it's not recognized it's either because of a different version or because of a typo in the groupId and/or artifactId. 如果它未被识别,则可能是因为版本不同,也可能是因为groupId和/或artifactId中的拼写错误。 com.xyz is probably fake, so please check that value again. com.xyz可能是假的,所以请再次检查该值。 Some may say that flat-projects (like this one) are not supported by the maven-release-plugin. 有些人可能会说maven-release-plugin不支持平面项目(比如这个)。 However, there are a lot of integration-tests which do confirm that flat projects are supported. 但是,有很多集成测试确实支持平面项目。

I think I have just found the solution, 我想我刚刚找到了解决方案,

I will do a more complete test and post results shortly. 我会做一个更完整的测试并很快发布结果。

Change the maven-release-plugin goals from this: 从这个改变maven-release-plugin目标:

          <goals>deploy assembly:single</goals>

to this 对此

          <goals>deploy</goals>

...the end... ...结束...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM