SpringBoot项目以jar包的方式导出

来源:互联网 发布:穿越火线交易软件 编辑:程序博客网 时间:2024/06/15 19:48

SpringBoot项目以jar包的方式导出

一般我们创建的springBoot项目都是Maven项目,项目以jar包的方式导出一般有以下步骤:

1.首先设置导出jar包的名字

在pom.xml文件中加上<finalName>test</finalName>代码

    <build>        <finalName>test</finalName>        <plugins>            <plugin>                <groupId>org.springframework.boot</groupId>                <artifactId>spring-boot-maven-plugin</artifactId>            </plugin>        </plugins>    </build>

2.更新此项目

这里写图片描述

3.Maven clean 项目

这里写图片描述

4.点击Maven install

这里写图片描述

通过以上步骤就可以在工作空间的项目目录下的target文件夹下找到test.jar包


如果点击Maven install遇到以下错误

[INFO] Scanning for projects...[INFO]                                                                         [INFO] ------------------------------------------------------------------------[INFO] Building Test 0.0.1-SNAPSHOT[INFO] ------------------------------------------------------------------------[INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Test ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] Copying 1 resource[INFO] Copying 1 resource[INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Test ---[INFO] Changes detected - recompiling the module![INFO] Compiling 8 source files to F:\Ruijie\Workspace\Test\target\classes[INFO] -------------------------------------------------------------[WARNING] COMPILATION WARNING : [INFO] -------------------------------------------------------------[WARNING] /F:/Ruijie/Workspace/Test/src/main/java/com/ruijie/Test/cache/RedisCache.java: F:\Ruijie\Workspace\Test\src\main\java\com\ruijie\Test\cache\RedisCache.java使用了未经检查或不安全的操作。[WARNING] /F:/Ruijie/Workspace/Test/src/main/java/com/ruijie/Test/cache/RedisCache.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。[INFO] 2 warnings [INFO] -------------------------------------------------------------[INFO] -------------------------------------------------------------[ERROR] COMPILATION ERROR : [INFO] -------------------------------------------------------------[ERROR] /F:/Ruijie/Workspace/Test/src/main/java/com/ruijie/Test/mapper/LoginMapper.java:[12,32] 注释值必须为类文字[INFO] 1 error[INFO] -------------------------------------------------------------[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 6.386 s[INFO] Finished at: 2017-11-30T15:15:49+08:00[INFO] Final Memory: 26M/187M[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Test: Compilation failure[ERROR] /F:/Ruijie/Workspace/Test/src/main/java/com/ruijie/Test/mapper/LoginMapper.java:[12,32] 注释值必须为类文字[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

我们可以使用Maven build操作此项目

这里写图片描述

然后在Goals输入框输入package

这里写图片描述

原创粉丝点击