最近用springboot做了一下mmall的api,在用mvn打包的时候出现了一些问题
打包命令
mvn clean package -Dmaven.test.skip=true
各种百度,网上找到两种方式
第一种 添加本地jar包到本地Maven仓库然后在在SpringBoot中pom.xml文件中添加依赖,这种方式主要是我换台机子还是要打包本地jar包,很不方便
第二种 主要修改一下pom.xml文件,添加依赖的时候使用本地包路径,如下
<dependency> <groupId>com.aliyun</groupId> <artifactId>aliyun-sdk-java</artifactId> <version>1.0.0</version> <scope>system</scope> <systemPath>${project.basedir}/libs/alipay-sdk-java20161213173952.jar</systemPath> </dependency> <dependency> <groupId>com.aliyun</groupId> <artifactId>alipay-trade-sdk</artifactId> <version>1.0.0</version> <scope>system</scope> <systemPath>${project.basedir}/libs/alipay-trade-sdk-20161215.jar</systemPath> </dependency>
在下面添加includeSystemScope为true,如下面
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> </plugin>
我这里使用第二种方式,在开发的时候没有问题,在用mvn命令打包的时候出现以下错误
两个本地包打包时候加载不到
[WARNING] 'dependencies.dependency.systemPath' for com.aliyun:aliyun-sdk-java:jar should not point at files within the project directory, ${project.basedir}/libs/alipay-sdk-java20161213173952.jar will be unresolvable by dependent projects @ line 82, column 16 [WARNING] 'dependencies.dependency.systemPath' for com.aliyun:alipay-trade-sdk:jar should not point at files within the project directory, ${project.basedir}/libs/alipay-trade-sdk-20161215.jar will be unresolvable by dependent projects @ line 89, column 16
于是各种百度没有结果,只能上google,查到了结果
解决方法
把${project.basedir}
修改成${pom.basedir}
在打包就没有这个错误了