Scenes
Maven introduces dependent jar packages, mostly through the use of coordinates in pom.xml to add dependencies.
If the jar package that needs to be referenced is not in the Maven central warehouse, how to introduce it into the project.
First create a new libs directory under the project directory
Put the jar package that needs to be imported in this directory
Then open pom.xml
Note:
Blog:
https://blog.csdn.net/badao_liumang_qizhi
Follow the public
account Domineering
programmers Get programming-related e-books, tutorial pushes and free downloads.
achieve
Where you add dependencies
<dependency>
<groupId>mobileimsdk4j_tcp</groupId>
<artifactId>mobileimsdk4j_tcp</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/libs/mobileimsdk4j_tcp.jar</systemPath>
</dependency>
Note that the coordinates and version number here are arbitrary, but the scope should write system, and then systemPath is the path of the jar package above
Then, if you use it in this way, you need to package these jar packages when you package the project.
Then you need to rely on packaged plugins
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>${project.basedir}/libs</extdirs>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
Pay attention to the path of extdirs here, here is the libs directory under the project root directory