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

Issue with properties inherited from parent POM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 3.0.3
    • None
    • None
    • java 1.6.0_24

    Description

      This worked absolutely fine in 2.2.1. Fails in 3.0.3.

      ./deps/pom.xml has:
      <properties>
      <mysql.connector.version>5.1.16</mysql.connector.version>
      </properties>

      ./library/pom.xml has:
      <parent>
      <groupId>com.mycompany</groupId>
      <artifactId>base</artifactId>
      <version>1.0</version>
      <relativePath>../deps/pom.xml</relativePath>
      </parent>
      ...
      <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>${mysql.connector.version}</version>
      <scope>runtime</scope>
      </dependency>

      ./otherlib/pom.xml has:
      <dependency>
      <groupId>com.mycompany</groupId>
      <artifactId>mycompany-library</artifactId>
      <version>1.0</version>
      <scope>compile</scope>
      </dependency>

      cd library
      mvn deploy (all good)

      cd otherlib
      mvn compile (fails)

      [ERROR] Failed to execute goal on project mycompany-otherlib: Could not resolve dependencies for project com.mycompany:mycompany-otherlib:jar:1.0: Failure to find mysql:mysql-connector-java:jar:${mysql.connector.version} in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

      It's as if it's treating the ${mysql.connector.version} in the runtime dependency literally, instead of resolving that property.

      I can work around this by adding this to library/pom.xml:
      <properties>
      <mysql.connector.version>5.1.16</mysql.connector.version>
      </properties>

      Please let me know if I'm missing something simple, but it worked fine without the workaround in 2.2.1, and this looks like a bug to me!

      Attachments

        1. MNG-5099.zip
          2 kB
          Benjamin Bentmann

        Activity

          People

            bentmann Benjamin Bentmann
            dcheckoway Dan Checkoway
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: