Maven stuck on old version of system dependency

10,319

I think the ${foo.version} might be getting resolved as a filter property. Can you check the properties file under src/main/filters.

Not sure if this is indeed the problem but just give it a try and update back.

The other reason that I could think of is - there might be a transitive dependency on com.example:foo:jar:2.1.1. That is some other dependency which needs 2.1.1 version of this artifact. You can find which artifact is bringing this transitively by doing mvn dependency:tree

Share:
10,319
Chris Conway
Author by

Chris Conway

I write code. I read code. I run code.

Updated on June 14, 2022

Comments

  • Chris Conway
    Chris Conway almost 2 years

    My Maven project has a dependency on a non-Maven library, which is coded as a system dependency:

    <dependency>
      <groupId>com.example</groupId>
      <artifactId>foo</artifactId>
      <version>${foo.version}</version>
      <scope>system</scope>
      <systemPath>${foo.jar}</systemPath>
    </dependency>
    

    where the location of the library can be controlled via local properties:

    <properties>
      <foo.version>2.1.1</foo.version>
      <foo.basedir>/usr/local</foo.basedir>
      <foo.libdir>${foo.basedir}/lib</foo.libdir>
      <foo.jar>${foo.basedir}/java/foo-${foo.version}.jar</foo.jar>
    </properties>
    

    Recently, the library switched from version 2.1.1 to version 2.2.0, so I changed the foo.version property, but Maven seems to be stuck on the old version:

    ...
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Failed to resolve artifact.
    
    Missing:
    ----------
    1) com.example:foo:jar:2.1.1
    ...
    

    I have run mvn dependency:purge-local-repository (many times, actually). The string 2.1.1 does not appear anywhere in my POM, profiles.xml, or settings.xml. Still, every time I try to build my project, Maven fails with the above error.

    What's going on here? Where is Maven storing the dependency version information and how can I update it?