Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve maven Packaging failure: there is no problem with package xxxx

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to solve the failure of maven packaging: there is no problem with the package xxxx, which can be used for reference by interested friends. I hope you can learn a lot after reading this article.

Introducing local jar packages with Maven is very unreasonable and can easily lead to confusion of team jar packages. It is best to try to build a private server solution.

1. The essence of the problem

Maven warehouse jar package download failed or project introduced local jar package Maven did not correspond to configuration

two。 Cause of the problem

(1) Maven failed to download jar package to local warehouse due to network or other reasons

(2) the project introduces the local jar package, which is configured only in the compiler but not in Maven.

3. Resolution steps

(1) check whether the local Maven repository jar package corresponding to the error Maven package has been downloaded completely

If you delete the file as shown above, you can download it again.

(2) if it appears in the compiler, you can find the jar package, but use the Maven package to report an error:

You need to check to see if the project introduces a local jar package but Maven does not configure it.

Solution 1

Find the folder where the third-party jar package is stored (such as src/main/webapp/WEB-INF/lib). Right-click AddasLibrary to join the project runtime:

Then configure the Maven packaging plug-in to scan for additional jar packages

Org.apache.maven.plugins maven-compiler-plugin 3.1 1.8 1.8 UTF-8-verbose-Xlint:unchecked-Xlint:deprecation-bootclasspath ${env.JAVA_HOME} / jre/lib/rt.jar-extdirs ${project.basedir} / src/main/webapp/WEB-INF/lib

Where ${project.basedir} is the project root node

The picture is quoted from: https://www.yisu.com/article/240010.htm, this method has been successfully tried by many people, but the author has not solved it.

Solution 2

Modify the pom file, introduce dependencies and set scope to system

Configure the Maven packaging plug-in

This method is feasible, but the number of local jar introduced by the author is so large that it is estimated that one by one will be exhausted.

Solution 3

After installing the jar package to the local warehouse, import it directly using the pom file, enter the jar directory that needs to be imported, and execute the following command

Mvn install:install-file-Dfile=druid-1.1.4.jar-DgroupId=com.alibaba-DartifactId=druid-Dversion=1.1.4-Dpackaging=jar

After execution, you can see the following files in the local warehouse, indicating that the installation was successful.

This method is feasible for the same reason as above, there are too many local jar introduced.

Solution 4

If any module cannot find the jar package, rebuild the model separately. Be careful not to use maven clean after rebuild.

Re-install after the rebuild is completed

Simple and rough, convenient and fast, very suitable for maintaining old projects. Don't do this to the new project and build a private server honestly.

Thank you for reading this article carefully. I hope the article "how to solve the maven packaging failure: there is no problem with the package xxxx" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report