<build> <sourceDirectory>src/main/java</sourceDirectory> <plugins> <!-- 打包插件 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <!-- 解决本地jar植入的插件 --> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> <compilerArguments> <extdirs>srcmainwebappWEB-INFlib</extdirs> </compilerArguments> </configuration> </plugin> </plugins> </build> <packaging>jar</packaging>
通过上述pom.xml文件完成打包前的配置工作
在终端中切换到工程目录运行:mvn clean package生成打包后的文件,java -jar 运行jar包 即可