spring boot 项目中 maven打第三方lib包时遇到的问题以及解决方法
1.打jar包时maven编译时会提示找不到第三方lib包下的类
<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}/src/main/webapp/WEB-INF/lib</extdirs> </compilerArguments> </configuration> </plugin> </plugins> </build>
2.打成的jar包中的BOOT-INF下的lib中并没有把上面的第三方的Lib目录下的jar包引入
<resources> <resource> <directory>C:\java_tool\MeteoInfo_2.1.3\MeteoInfo\lib</directory> <targetPath>BOOT-INF/lib/</targetPath> </resource> </resources>
3.过程中还遇到的。logback.jar和第三方Jar包冲突的问题
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <!-- 去除旧log依赖 --> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </exclusion> </exclusions> </dependency> <!--引入spring-boot-starter,排除spring-boot-starter-logging--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency>