1、先clean下项目
2、项目右键-run as -maven install
等待运行 BUILD SUCCESS
3、打开项目所在文件夹,找到 target 文件夹,有打包生成的jar包
4、测试jar包,当前目录下进cmd,输入
java -jar xxxx.jar
1、打开项目所在文件夹,当前目录下进cmd,输入
mvn package -Dmaven.test.skip=true
解决办法:在pom.xml中添加如下语句,可跳过测试
<!-- -Eclipse 中 Maven 打包项目时如何跳过 test 用例 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
解决办法:在pom.xml中注释掉如下语句:
<!--<plugin>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-maven-plugin</artifactId>-->
<!--</plugin>-->
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Total': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.apache.commons.dbcp.BasicDataSource] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
Caused by: java.lang.NoClassDefFoundError: org/codehaus/xfire
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:662)
... 55 more
解决办法:maven仓库配置 org/codehaus/xfire 即可
<dependency>
<groupId>org.codehaus</groupId>
<artifactId>xfire</artifactId>
<version>1.2.6-all-patch-671</version>
</dependency>
则可以采用命令行安装 jar包。见链接