In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how to solve the Maven project local public common package cache problem, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Maven project local public common package cache
Background: the Spring Cloud + Maven,Maven repository is developed locally.
Development tool: intellij idea
Project architecture: SpringBoot microservice distributed architecture
Ps:STS caching is more serious (the Spring plug-in version of MyEclipse is: STS)
More and more Web projects use Maven build version management and control as well as third-party resource library file tools, such as: SSM architecture, SpringCloud+Maven and so on.
Maven has obvious advantages over other tools in version management and the introduction of third-party repository files.
However, in the process of use, there will be some defects:
This flaw is reflected in Maven caching, especially when using local repositories.
The project is divided into multiple modules, so it is developed with multiple subsystems, sub-libraries and tables, so that some common resource codes will be extracted and encapsulated in Common packages.
In the form of a local jar package, it is easy for everyone to call without having to write some repetitive code for each project to cause redundancy (traditional architectural shortcomings).
problem
When the Common package is updated and released to the warehouse. Right-click the local development tools project-> Maven-- > ReImport as follows:
Or right-click the pom.xml configuration file of the project: Maven-- > ReImport or right-click: Maven-- > ReImport after opening the file
The updated Cmomon package contents can be reintroduced, but sometimes the ReImport is invalid because of cache reasons. At this time, please do not doubt that others did not update the release, but the problem of caching.
Solution method
Find the Common package path of the local warehouse, such as my local: C:\ Users\ Administrator\ .m2\ repository\ com\ epa*ks\ estores\ common\
Delete all items under this path, then re-ReImport the project, and the problem is solved.
Note: the compiled local project jar package cannot be deleted.
Problems caused by maven caching
There is a new problem today. No matter how much the pom file is updated, the mvn eclipse:eclipse command fails to introduce the jar package, but does not report an error.
Try to make the jar package into a version in which the local library does not exist (the remote library does not exist). Once again, the mvn eclipse:eclipse result immediately reported an error, saying that there is no dependent package, which is speechless. If there is no jar package, you say I do not have it, and you do not bring it to me if there is a jar package.
After repeated twists and turns, first delete the jar package of the local library, and then mvn eclipse:eclipse, it is OK. If there is no remote warehouse, then you only need to mvn install to the local after mvn eclipse:eclipse.
Solved the problem. Maven pretends to be smart and looks smart, but he doesn't know it. In a word, the design of maven is very stupid.
The above is all the content of the article "how to solve the local public common package caching problem of Maven project". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.