- 先在码云下载 OneBlog 的源码,源码地址
- 解压源码,导入 IDEA 工具。找到 docs-->db 里的 sql 文件导入数据
- 修改数据库配置,找到 blog-web 和 blog-admin 的启动类启动,分别访问 web 页面 localhost:8443 和后台管理页面 localhost:8085
- 没有问题,接下来打包;执行 maven 命令的 clean,执行成功后执行 install 命令,OK 这个时候会遇到执行 install 失败,报错,报错信息如下
[INFO] blog ............................................... SUCCESS [ 0.215 s]
[INFO] blog-core .......................................... SUCCESS [ 4.550 s]
[INFO] blog-web ........................................... FAILURE [ 12.997 s]
[INFO] blog-admin ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.330 s
[INFO] Finished at: 2018-11-29T09:12:45+08:00
[INFO] Final Memory: 32M/348M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project blog-web: There are test failures.
[ERROR]
[ERROR] Please refer to D:\tools\workspace1\DBlog\blog-web\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :blog-web
这个报错是缺少 maven-surefire-plugin 依赖,这个依赖是用来跳过单元测试
解决办法,在父类的 POM 文件中加入此依赖,如下
<!-- 跳过单元测试 -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
OK,问题解决,打包成功!包 target 目录中的 jar 包拷贝出来,运行 Java -jar xxx.jar 启动服务;
如还有其他问题可参考,张亚东的博客,及码云问题总结文档
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于