tags:

views:

75

answers:

1

Hi,

I have a multi module project (flat structure) as follows

parentpom (1.1-SNAPSHOT)
moduleA (inherits parentpom version, depends on moduleB(1.1-SNAPSHOT))
moduleB (inherits parentpom version)
aggregator (inherits parentpom version, aggregates moduleA, moduleB)

The aggregator allows me to build, install and deploy moduleA and moduleB at the same time, and appears to do what I expect.

When I try and do a release of version 1.1, I can't because moduleA depends on moduleB(1.1-SNAPSHOT), resulting in the following error: "Can't release project due to non released dependencies"

I thought that using the aggregator would allow me to do a "synchronised" release of moduleA and moduleB, automatically updating moduleA to depend on moduleB(1.1). What would be the correct way of achieving this?

Thanks

+1  A: 

How to release a multi-module project with non released dependencies

To strictly answer this question, this is not possible, at least not with the Maven Release Plugin. And if you don't use the Maven Release Plugin and do the release manually, you should not do that anyway.

Reason: the build of a released should be repeatable, building it later from its sources should give the exact same reasult. Having some SNAPSHOT dependencies in some released POM totally defeats this goal. Which is why the Maven Release Plugin enforces this.

I thought that using the aggregator would allow me to do a "synchronised" release of moduleA and moduleB, automatically updating moduleA to depend on moduleB(1.1). What would be the correct way of achieving this?

Are the versions hard coded? If they are, this might be the problem.

  • moduleB and moduleA shouldn't declare any version, they inherit it from the parent POM

  • moduleA should use the built-in properties to declare its dependency on B

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>moduleB</artifactId>
      <version>${project.version}</version>
    </dependency>
    
Pascal Thivent