Maven has packages locally but cannot be brought in
If the required package exists locally but cannot be introduced, please follow these steps to resolve the issue:
1. Make sure that the package exists in your local Maven repository
By default, Maven will store the downloaded dependency package in{}/.m2/repository
in the directory.
You can check whether the package exists by browsing this directory.
2. Check your files
Make sure you correctly add the dependencies for the required package.
Can be passed independencies
Add the following code to the tag to add dependencies:
<dependency> <groupId>PackedgroupId</groupId> <artifactId>PackedartifactId</artifactId> <version>Packed版本</version> </dependency>
3. Check if your project is correctly built in Maven
Run in the project root directorymvn clean install
Commands to ensure that Maven downloads and installs dependencies correctly.
4. If the package does exist in your Maven repository
But it still cannot be introduced, probably because of problems with Maven's local cache.
In this case, you can try to clear Maven's local cache.
- Run on the command line
mvn dependency:purge-local-repository
Command to clear Maven's local cache. - Rerun
mvn clean install
Commands to re-download and install dependencies.
5. If none of the above steps can solve the problem
You can try to delete the entire local Maven repository and then run it againmvn clean install
Command to re-download and install all dependencies.
When deleting a repository, make sure to back up important dependencies.
Summarize
The above is personal experience. I hope you can give you a reference and I hope you can support me more.