Idea Maven project uses package to package and report error (package does not exist)

Scene: I pass File -> Project Structure -> Modules and Libraries have added an external Jar that runs normally in the project, but the following error occurred when packaging with Maven’s package

Solution: Configure the Jar to a pom.xml file and you can package it properly
Steps:
1. Open the Terminal execution (Terminal window at the bottom of the IDEA interface)

mvn install:install-file -DgroupId=com.external -DartifactId=http-sdk -Dversion=1.2.6-SNAPSHOT -Dpackaging=jar -Dfile=C:\Users\Administrator\Desktop\BOOT-INF\lib\http.jar 

2. Add the following dependencies to the pom.xml file

<dependency>
    <groupId>com.souche</groupId>
    <artifactId>msgcenter-sdk</artifactId>
    <version>1.2.6-SNAPSHOT</version>
</dependency>

The -dgrouPID corresponds to the groupid-dartifactid in the POM and the artifactitid-Dversion corresponds to the version-dpackaging import package which is a TYPE of JAR and that’s the jar-DFile where you put the JAR that you downloaded from the POM

Once you run the command, you can see the corresponding JAR in the local Maven repository

 

And then re-execute
Compile and package MVN Clean Package (install)
Or choose the right side of the IDEA interface, select the Maven status bar and click package packaging

 

 

The required configuration in the POM.xml file

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

 

 

Read More: