You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rodrigo Ruiz <rr...@gridsystems.com> on 2009/03/20 13:19:28 UTC

Using a property for classifiers fails in transitive dependencies

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I am facing this problem in a project migration to Maven. Some of the
sub-projects to be migrated are native libraries that currently are
encapsulated in jars. I want to use the classifier for distinguising the
jars to be used in different platforms. The system already supports all
this stuff at runtime, so I just need to choose the right classifiers
for each platform I build on.

I am aware of the NAR plugin, and the migration to it is scheduled for a
later phase, but it is too expensive (in terms of effort) for being done
right now :'(

For now, I am just leaving the current build system (ant based) for
these projects, and adding a final step for "local-install" the
resulting jars.


The problem arises in the following configuration (I define a property
in my settings.xml called "platform.name" which in my case is set to
"windows+x86"):

Master Project
  |
  +-- Project A (native)
  |
  +-- Project B (depends on A)
  |
  +-- Project C (depends on B)

The following are some excerpts of these projects:

<project>
  <artifactId>Master</artifactId>

  <properties>
    <A.version>1.0</A.version>
    <B.version>1.0</B.version>
    <C.version>1.0</C.version>
  </properties>
</project>

<project>
  <parent>
    <artifactId>Master</artifactId>
  </parent>
  <artifactId>A</artifactId>
  <version>${A.version}</version>
  <classifier>${platform.name}</classifier>
</project>

<project>
  <parent>
    <artifactId>Master</artifactId>
  </parent>
  <artifactId>B</artifactId>
  <version>${B.version}</version>
  <dependencies>
    <dependency>
      <artifactId>A</artifactId>
      <version>${A.version}</version>
      <classifier>${platform.name}</classifier>
    </dependency>
  </dependencies>
</project>


<project>
  <parent>
    <artifactId>Master</artifactId>
  </parent>
  <artifactId>C</artifactId>
  <version>${C.version}</version>
  <dependencies>
    <dependency>
      <artifactId>B</artifactId>
      <version>${B.version}</version>
    </dependency>
  </dependencies>
</project>


With such poms, the result is:

* Project B works OK, it depends on A-1.0-windows+x86.jar
* Project C fails: it does not find "A:jar:${platform.name}:1.0"


It looks like property names are not resolved in classifiers of
transitive dependencies , am I right? (The version number is defined in
a property in the Master project, so I am quite sure property names are
being correctly resolved in versions)

I have tested this with Maven 2.0.9 and 2.0.10. I am not allowed to use
Maven 2.1.0 in our build system until a final release is available, so I
have not tested it yet.


Any insight would be more than welcome,

- --
- -------------------------------------------------------------------
GRID SYSTEMS, S.A.             Rodrigo Ruiz
Parc Bit - Edificio 17         Analyst/Programmer
07121 Palma de Mallorca
Baleares - Spain
http://www.gridsystems.com/
- -------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)

iEYEARECAAYFAknDidAACgkQp9m/F5UenDperQCfc8xtjwsbEx1+zhrXn/Yiu0Q0
NbMAn0lNq9JbwLvsg5Ex5E30ogxEyPbk
=h+lm
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org