Clear Maven Cache: Solution to transitive dependencies not updating on clean install

Follow these steps when maven clean install just doesn’t update the transitive dependencies in nested projects.

rm -rf .m2/repository/path-to-your-library
cd your-project-folder
find . -maxdepth 2 -name "pom.xml"  -exec mvn clean -f '{}' \;
mvn clean install -DskipTests=true
#confirm if the versions are as you wanted
mvn dependency:tree | grep -B 75 the-bugging-library

If the above method doesn’t work, you might have missed to add the required version in the dependency management.

Lets assume BL is the library which has been bugging you with these version issues 😉

cd your-mvn-parent-project
vi pom.xml
#add
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>BL-group</groupId>
                <artifactId>BL-artefact</artifactId>
                <version>required-version-of-the-BL</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

Let me know if these steps helped.

Kj
Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.

Leave a Comment

Your email address will not be published. Required fields are marked *