If your project is built with Maven, you may encounter such problems when the project is online and deployed to the server. The problem is that there is no MAVEN environment on the server, that is, the jar packages in the warehouses (repository) that the project relies on, you need to extract them separately and upload them to the server, the solution:
Pre: Install complete maven in eclipse (specifically participate in pre-maven combat) and project for the ' Maven WebApp project ' type, taking spring-petclinic as an example
Approach 1:MVN Package
Pom.xml:<packaging> is war, MVN package's command calls the project-dependent jar package to the Lib folder under Web-inf, as shown in the figure:
, and the console prompts the war package location information when completed
Approach 2:MVN assembly:assembly
The newly generated {Artifactid}-jar-with-dependencies.jar file is found under the ${project}/target folder, and during the execution of the command, MAVEN exports the packages that the jar package relies on. and unpack (unpackage), put together in this {Artifactid}-jar-with-dependencies.jar package
Note: pom.xml:
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
This jar-with-dependencies is a assembly written, assembly description Reference (assembly descriptor)
Option 3: Separate deployment by third party package
A: Modify the Pom.xml <descriptorRef>jar-with-dependencies</descriptorRef> path, modified to: <descriptorref>src/ Main/assembly/src.xml</descriptorref>
B: Create the Src.xml file under the project name/src/main/assembly:
<assembly
Xmlns= "http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http:// Maven.apache.org/xsd/assembly-1.1.0.xsd ">
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
</fileSet>
</fileSets>
</assembly>
C: Re-execute MVN assembly:assembly
This will see the newly created {Artifactid}-jar-with-dependencies.jar in the target folder, where all the third-party packages that the project relies on are packaged in the same type.