方法1: 在pom.xml 里面加上maven打包的配置

<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>2.0.0.RELEASE</version>
<!-- Don't forget about this value !! -->
<extensions>true</extensions>
<configuration>
<!-- Provide the base class for your auto-generated tests -->
<baseClassForTests>com.springboot.cloud.demos.producer.MvcMockTest</baseClassForTests>
</configuration>
</plugin>
<!--docker镜像build插件-->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<!-- 注意imageName一定要是符合正则[a-z0-9-_.]的,否则构建不会成功 -->
<imageName>cike/${project.artifactId}</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<rm>true</rm>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>


然后在
terminal 打上命名 mvn package

idea  java 打包的方法

 

 

在cmd命令 里面打开运行 , 命令是:

java -server -Xms20M -Xmx50M -jar  Jar包地址(默认在方案下面的target目录下)

 

idea  java 打包的方法

 

 

 

方法2,用idea进行打包, File->Project Stricture    Include in project builder 记得扣选,不然打包进去没有东西

idea  java 打包的方法

 

 

idea  java 打包的方法

 

相关文章:

  • 2021-10-18
  • 2022-12-23
  • 2021-11-28
  • 2021-06-13
  • 2022-01-08
  • 2021-06-27
  • 2021-04-20
猜你喜欢
  • 2021-10-22
  • 2022-01-12
  • 2021-08-03
  • 2021-09-17
  • 2022-12-23
  • 2021-11-19
  • 2021-07-20
相关资源
相似解决方案