Maven introduces the local jar package and packs it into the war package
1. General
In normal development, some jar packages are not included in Maven's central warehouse for various reasons, so they need to be imported locally.
2. Copy to the project root directory
The project root directory is POM For the same level directory where the XML file is located, you can create a folder lib under the project root directory, as shown in the following figure:
These four jar packages are required to identify the web page code.
3. Configure POM XML, relying on local jar
Configure the dependency of jar, including three attributes: groupid, artifactid and version, as well as the scope and SystemPath attributes. Specify the source of jar package from local file and the path of local file respectively.
Where ${basedir} refers to the project root path
4. Configure Maven plug-in to package local jars into war
After the above configuration, the class in the jar package can be introduced when writing code. However, when packaging, because scope = system, the jar package will not be entered into the war package by default. All need to be packaged through the plug-in.
Modify POM XML file, add the following code under the plugins tag
In this way, the war package will contain locally imported jar dependencies.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.