Mac下maven项目打包方式

来源:互联网 发布:编程之魂 译者 编辑:程序博客网 时间:2024/06/06 16:56
1.配置端口信息和打包信息
1.1:先商量所做项目的端口号 在application.xml设置商量后的端口号如:server: port: 3373
1.2.再在pom.xml依赖文件下配置打包以来环境:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
1.3最后的依赖效果
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
2.进行打包
2.1先移动到项目目录下:如 localhost:~ apple$ cd /Users/apple/Desktop/receiver

2.2在到当前目录下 敲入命令行:localhost:~ apple$ mvn package -Dmaven.test.skip=true
接下来进行打包操作 打包成功后,会在工程项目的target文件夹下生成一个receiver-0.0.1-SNAPSHOT-exec.jar包和receiver-0.0.1-SNAPSHOT.jar包

3.用命令行运行打包项目文件
在命令行下进行运行服务器
3.1先移动到目录下:localhost:~ apple$ cd /Users/apple/Desktop/last_sure/receiver/target
3.2在输入localhost:~ apple$ java -jar receiver-0.0.1-SNAPSHOT-exec.jar

4.其他操作
如果需要重新打包 先删除上诉两个jar文件 进行重新编译 在执行 2 相关操作
原创粉丝点击