Tag: maven

  • 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.

  • Fix the error: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags during maven builds

    Problem: Maven package gives this compile time error when using Open JDK.

    Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> [Help 1]

    Reason: Lombok version included in the project seemingly had a dependency on Oracle JDK, which is fixed in 1.18.2

    Fix: Upgrade lombok to 1.18.2 in the POM file.

    		<dependency>
    			<groupId>org.projectlombok</groupId>
    			<artifactId>lombok</artifactId>
    			<version>1.18.2</version>
    			<scope>provided</scope>
    		</dependency>