idea java 打包的方法

方法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

 

 

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

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

 

 

 

 

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

 

 

 

posted @ 2019-09-10 18:56  ☆♂安♀★  阅读(2353)  评论(0编辑  收藏  举报