I am trying to get rid of a jar from my Maven Dependencies folder which is automatically generated in eclipse. As this folder is not editable, I tried deleting the corresponding jar manually from .m2/repository and also removed the jar from my pom file and refreshed eclipse project. But no impact. Jar continues to stay in dependencies folder in eclipse. Then, I re-started my laptop. now jar is re-populated in .m2/repository and of course its in maven dependencies folder in eclipse as well. any suggestions.
If you want to explicitly remove a single artifact from the cache, use purge-local-repository with the manualInclude parameter. For example, from the command line: mvn dependency:purge-local-repository -DmanualInclude="groupId:artifactId, ..."
You can find this in Window > Preferences > Maven > User Settings , and then point Global Settings to your external maven settings. xml . Then i removed the broken projects and re-added them, and the Maven Dependencies library appeared again. Save this answer.
Apache Maven Shade Plugin provides the capability to package the artifact in an uber-jar, which consists of all dependencies required to run the project.
If the jar is a dependency of another library you have included in your POM then you may have to exclude that library in the POM. The spring framework must have some kind of logging but if you do not want to use apache commons logging and would rather use something else you must exclude the offending library:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
commons-logging-1.1.1.jar will nolonger litter my maven dependencies.
One thing to note is that you must exclude it from every dependency that requires it (e.g. if you have spring-context and spring-core in your pom you must put the <exclusions>
section in each <dependency></dependency>
).
Eclipse m2 plugin has a nifty little extension that allows you to right click on the jar then select Maven -> Exclude Maven artifact...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With