Introduce the local jar without building a private server, and package the local jar into the project's run jar
Take the packaging and introduction of hadoop-common-2.7.5.jar as an example
quote
Copy the path where the jar package is located
Open cmd command prompt
Change the path to the directory where the jar is located
e:
cd E:\Xunlei download\hadoop-2.7.5\share\hadoop\common
Add the jar package to the local repository
mvn install:install-file -Dfile=hadoop-common-2.7.5.jar -DgroupId=com.apache.hadoop -DartifactId=hadoop-common -Dversion=2.7.5 -Dpackaging=jar
Parameter Description:
-Dfile: full name of the jar
-DgroupId: Unique ID of custom project collection or project group
-DartifactId: custom project unique identifier
-Dversion: version number
C:\Users\admin\.m2\repository in the C:\Users current user (admin) directory of the computer will generate the corresponding directory structure com\apache\hadoop\hadoop-common\2.7.5
C:\Users\admin\.m2\repository\com\apache\hadoop\hadoop-common\2.7.5 directory is the required jar
My maven local warehouse directory is E:\mavenWarehouse\warehouse
Create a directory structure like com\apache\hadoop\hadoop-common in the configured maven local warehouse directory
E:\mavenWarehouse\warehouse\com\apache\hadoop\hadoop-common
Copy the files and directories in the generated C:\Users\admin\.m2\repository\com\apache\hadoop\hadoop-common directory to the newly created directory E:\mavenWarehouse\warehouse\com\apache\hadoop\hadoop -common
Add dependency references to the project's pom.xml
<dependency>
<groupId>com.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.7.5</version>
</dependency>
打包
Add packaged
plugins to the plugins tag group
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.xiao.chun.ChunApplication</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Description: Fill in the full name of the main method class in the mainClass tag group
Click clean to run and click assembly: assembly
After the operation is completed, the jar is opened in the target directory of the workspace of the project disk with the compression software, and the referenced jar can be found in the BOOT-INF\lib directory.