Ticket #284 (closed defect: wontfix)

Opened 2 years ago

Last modified 9 months ago

Using ${version} for subproject dependencies doesn't work (maven uses 2.4.1 version instead)

Reported by: ebrown Assigned to: ronald
Priority: unassigned Milestone: 0.9.0
Component: build-system Version:
Keywords: maven Cc:
Blocking: Blocked By:

Description

See CodehausJira:MNG-2653 (though root cause may be CodehausJira:MNG-2651).

From Ronald:

Version is not always inherited correctly (if not specified in the pom, it sometimes gets a random version depending on what other things are being loaded). We've worked around this mostly by ensuring explicit versions everywhere, but it still rears its head occasionally on external poms.

More details:

<project>
 <modelVersion>4.0.0</modelVersion>
 <artifactId>foo</artifactId>

 <parent>
   <groupId>group</groupId>
   <artifactId>bar</artifactId>
   <version>1.2.3</version>
 </parent>

The current project is supposed to inherit the version from the  
parent,
i.e. also have version 1.2.3. In some weird cases this doesn't happen
properly, and shows up with mvn trying to find/download some random
version of the artifact.

The first time this happened was before you joined - here's the
relevant part of the email I sent out then:

-------------------------------------------------------------------
Due to a bug in maven (I think), the build will fail with the  
following
error:

 [INFO] Failed to resolve artifact.

 Missing:
 ----------
 1) org.codehaus.cargo:cargo-core-api-container:jar:2.4.1

   Try downloading the file manually from the project website.

   Then, install it using the command:
       mvn install:install-file -DgroupId=org.codehaus.cargo - 
DartifactId=cargo-core-api-container \
           -Dversion=2.4.1 -Dpackaging=jar -Dfile=/path/to/file

   Path to dependency:
         1) org.codehaus.cargo:cargo-maven2-plugin:maven-plugin:0.2
         2) org.codehaus.cargo:cargo-core-container-resin:jar:0.8
         3) org.codehaus.cargo:cargo-core-api-container:jar:2.4.1

 ----------
 1 required artifact is missing.

To fix this, edit

 ~/.m2/repository/org/codehaus/cargo/cargo-core-containers/0.8/ 
cargo-core-containers-0.8.pom

and replace the "${version}" with "0.8". From then on the builds will
work fine. I'll probably submit a bug-report on this.
-------------------------------------------------------------------

If you look at the cargo-core-containers-0.8.pom you'll see the user
of ${version} in one of the dependencies, which should be the current
artifact's version, but got assigned the random version 2.4.1 above.

Note that this is a hard to reproduce bug: it only happened with
certain sets and versions of stuff in your local repository and in
your build (IIRC if you ran the build from somewhere other than head
it worked).

Dependency Graph

Change History

02/15/07 18:51:50 changed by ebrown

I wonder if fixing #283/CodehausJira:MNG-624 will fix this one?

08/07/07 16:25:51 changed by

  • milestone deleted.

Milestone Bugs deleted

10/29/07 20:31:28 changed by amit

  • owner changed from ebrown to amit.
  • component changed from maven to build-system.

03/10/08 08:00:21 changed by amit

  • owner changed from amit to ronald.
  • milestone set to 0.9.0.

Not sure what the status of this is anymore.

03/17/08 23:00:14 changed by ronald

We have explicitly defined the version in every project, instead of trying to rely on inheritance. We could wait for this to get fixed in maven, and then require that version of maven, or we can just let things be. It's a bit uglier than necessary, but the release plugin takes care of rewriting all versions during a release.

Therefore I think we can close this as wont-fix.

03/18/08 08:06:44 changed by amit

  • status changed from new to closed.
  • resolution set to wontfix.