Question

When you run the maven war:inplace all the classes and libraries are copied to the webapp folder of your project. When I update the version number of a library, i end up with two versions of the respective jar in the lib folder, the old one and the new one.

Is there any way to clean the lib folder before the new libraries get copied?

("mvn clean install war:inplace" doesn't do the job...)

Was it helpful?

Solution

I had to do this exact same thing in my projects, here's what I did:

Add the following to your pom.xml within the <plugins> tag, it customizes the clean plugin to remove the WEB-INF/classes and WEB-INF/lib directories:

<plugin>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
        <filesets>
            <fileset>
                <directory>src/main/webapp/WEB-INF/classes</directory>
            </fileset>
            <fileset>
                <directory>src/main/webapp/WEB-INF/lib</directory>
            </fileset>
        </filesets>
    </configuration>
</plugin>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top