Explanation: Sometimes there are some jar packages that are not included in the maven central warehouse and Alibaba cloud warehouse, which need to be manually downloaded to the local to manually add maven dependencies. Take the IK expression IKExpression jar package as an example
first step
Download the IKEExpression package. Students who do not have this package can click to download the Alibaba Cloud disk to share
second step
Find the location of the local maven warehouse of your project. If you are not sure, you can check the maven configuration file setting local warehouse pointing to
Find the corresponding local warehouse location
third step
Edit your project module pom to specify the dependent attention naming method is critical
groupId top.cctvo project affiliation (or company main website)
I am used to using thirdparty as the directory name for storing third-party jars
artifactId directly uses IKEExpression (according to the name of the jar package you downloaded)
version is the version you downloaded jar
the fourth step
Many students will ask how to put the jar in the maven warehouse, how to order the location, and how to create the directory, (good question)
At this time, after configuring the third step, click on the project to install or refresh the project. Maven will automatically create the corresponding warehouse directory for you, but it will prompt you that the jar package warehouse of IKEExpression cannot be found, and it must not be found. You download it The jar package is not put in;
No nonsense, directly put the downloaded package under the address file created by maven for me;
At this time, you will find that there are not as many files under this file as mine. First of all, you don’t need to worry about other packages. The core thing is that we need to manually create a pom file under this folder inside. Otherwise, if you have a jar package, you still can’t install it. successful;
the fifth step
Create a pom configuration file
Note: Two points 1. The best naming convention for the .pom file is the name of the jar package to be imported plus - plus the version number plus the .pom suffix (this place is easy to overturn and you must pay attention to the jar name format) I downloaded the IKEExpression jar package from other websites The name is IKEExpression2.1.2.jar. The name of the jar package is "-" without a horizontal bar. This huge pit caused us to fail to find the jar package after configuration) 2. pom file configuration
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>top.cctv0.bom</groupId>
<artifactId>cctv0-bom</artifactId>
<version>2023.7</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>top.cctv0.webapp</groupId>
<artifactId>cctv0-webapp</artifactId>
<packaging>pom</packaging>
<name>cctv0-webapp</name>
<!-- 项目依赖 -->
<dependencies>
<dependency>
<groupId>top.cctv0.thirdparty</groupId>
<artifactId>IKExpression</artifactId>
<version>2.1.2</version>
</dependency>
<dependencies>
</project>
The manually created pom first copies the pom's standard identifier <?xml......> and a bunch of things (you can also use mine to change)
The next step is to add the parent of your own project properties. It should be noted that the groupId here is the id of the parent package of the IKEExpression package you depend on, followed by the dependency of this pom pointing to yourself. Note that you must write in the third step of your project Same
step six
Then intall your project pom install successfully and you're done!