Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6689

Cannot find the defined variable in sub-component

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3.3
    • Fix Version/s: None
    • Component/s: Dependencies
    • Labels:
      None
    • Environment:
      Mac OS

      Description

      I have a very simple project , the project hierarchy is as follow:

      Top  level :  test

      <groupId>com.pallas</groupId>
        <artifactId>pallas</artifactId>
        <packaging>pom</packaging>
        <version>${pallas.version}</version>
        <name>Pallas</name>
        <url>http://maven.apache.org</url>

        <modules>
            <module>datamodel</module>
            <module>moduleb</module>
        </modules>

       

      <properties>
          <topLevelArtifactId>pallas</topLevelArtifactId>
          <pallas.version>1.0.0</pallas.version>
          <java.source.version>1.8</java.source.version>
          <java.target.version>1.8</java.target.version>
          <source.encoding>UTF-8</source.encoding>
          <jackson.version>2.9.9</jackson.version>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>

       

      As you can see it has two sub-modules.  module "moduleb" will dependent on module "datamodel"

       

      How to re-produce the issue.

       

      1> down load the attached project file test.tar

      2> untar it and change to the test directory.

      3> run "mvn -U clean install"  everything will be fine and you will get success

      4> change to test/datamodel directory run "mvn -U clean install"  everything will be fine and you will get success

      5> change to test/moduleb directory  run "mvn -U clean install"  it will failed. with the follow error

      "Could not resolve dependencies for project com.pallas:moduleb:jar:1.0.0: Failed to collect dependencies at com.pallas:datamodel:jar:1.0.0: Failed to read artifact descriptor for com.pallas:datamodel:jar:1.0.0: Could not find artifact com.pallas:pallas:pom:${pallas.version}"

       

      Temporary workaround:

      make the follow changes in test/datamodel/pom.xml

      from:

      <parent>
              <groupId>com.pallas</groupId>
              <artifactId>pallas</artifactId>
              <version>${pallas.version}</version>
              <relativePath>../pom.xml</relativePath>
        </parent>

       

      to

       

      <parent>
              <groupId>com.pallas</groupId>
              <artifactId>pallas</artifactId>
              <version>1.0.0</version>
              <relativePath>../pom.xml</relativePath>
        </parent>

       

      So it seems we cannot use property in parent section ?

       

        Attachments

        1. test.tar
          188 kB
          Yixing Jia

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              yixing Yixing Jia
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: