当前位置: 首页 > news >正文

贵州省住房和城乡建设厅网站报名网厨师培训学校

贵州省住房和城乡建设厅网站报名网,厨师培训学校,哪个域名网站好,永久免费虚拟主机申请Maven工程打jar包 一、IDEA自带打包插件二、maven插件打包2.1 制作瘦包(直接打包,不打包依赖包)2.2 制作瘦包和依赖包(相互分离)2.3 制作胖包(项目依赖包和项目打为一个包)2.4 制作胖包&#xf…

Maven工程打jar包

  • 一、IDEA自带打包插件
  • 二、maven插件打包
    • 2.1 制作瘦包(直接打包,不打包依赖包)
    • 2.2 制作瘦包和依赖包(相互分离)
    • 2.3 制作胖包(项目依赖包和项目打为一个包)
    • 2.4 制作胖包(transform部分自定义)
  • 三、SpringBoot项目打包
  • 四、Scala项目打包
  • 五、groovy项目打包

一、IDEA自带打包插件

内容:此种方式可以自己选择制作胖包或者瘦包,但推荐此种方式制作瘦包。
输出:输出目录在out目录下
流程步骤

  1. 第一步: 依次选择 file->projecct structure->artifacts->点击+ (选择jar)->选择 from module with dependencies
    在这里插入图片描述
  2. 第二步:弹出窗口中指定Main Class,是否选择依赖jar包,是否包含测试。(尽量不选依赖包,防止依赖包选择不全)
    在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述
  3. 第三步:点击Build–>Build Artifacts–>选择bulid

二、maven插件打包

输出:输出目录在target目录下

2.1 制作瘦包(直接打包,不打包依赖包)

内容:仅打包出项目中的代码到JAR包中。
方式:在pom.xml中添加如下plugin; 随后执行maven install

 <!-- java编译插件 -->
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>指定版本</version><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration>
</plugin>

2.2 制作瘦包和依赖包(相互分离)

内容:将依赖JAR包输出到lib目录方式(打包方式对于JAVA项目是通用的)
将项目中的JAR包的依赖包输出到指定的目录下,修改outputDirectory配置,如下面的${project.build.directory}/lib。
方式

  1. pom.xml的build>plugins中添加如下配置。
  2. 点击maven project(右边栏)->选择Lifecycle->点击package打包
    注意:如果想将打包好的JAR包通过命令直接运行,如java -jar xx.jar。需要制定manifest配置的classpathPrefix与上面配置的相对应。如上面把依赖JAR包输出到了lib,则这里的classpathPrefix也应指定为lib/;同时,并指定出程序的入口类,在配置mainClass节点中配好入口类的全类名。
<plugins>
<!-- java编译插件 -->
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration>
</plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><configuration><archive><manifest><addClasspath>true</addClasspath><classpathPrefix>lib/</classpathPrefix><mainClass>com.yourpakagename.mainClassName</mainClass></manifest></archive></configuration>
</plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><executions><execution><id>copy</id><phase>install</phase><goals><goal>copy-dependencies</goal></goals><configuration><outputDirectory>${project.build.directory}/lib</outputDirectory></configuration></execution></executions>
</plugin>
</plugins>

注意:默认的classpath会在jar包内。为了方便,可以在Main方法配置后加上manifestEntries配置,指定classpath。

<plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-jar-plugin</artifactId>  <configuration>  <classesDirectory>target/classes/</classesDirectory>  <archive>  <manifest>  <!-- 主函数的入口 -->  <mainClass>com.yourpakagename.mainClassName</mainClass>  <!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->  <useUniqueVersions>false</useUniqueVersions>  <addClasspath>true</addClasspath>  <classpathPrefix>lib/</classpathPrefix>  </manifest>  <manifestEntries>  <Class-Path>.</Class-Path>  </manifestEntries>  </archive>  </configuration>  
</plugin>  

2.3 制作胖包(项目依赖包和项目打为一个包)

内容:将项目中的依赖包和项目代码都打为一个JAR包
方式

  1. pom.xml的build>plugins中添加如下配置;
  2. 点击maven project(右边栏)->选择Plugins->选择assembly->点击assembly:assembly
    注意:1. 针对传统的JAVA项目打包;
    2. 打包指令为插件的assembly命令,尽量不用package指令。
<plugin><groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-assembly-plugin</artifactId>  <version>2.5.5</version>  <configuration>  <archive>  <manifest>  <mainClass>com.xxg.Main</mainClass>  </manifest>  </archive>  <descriptorRefs>  <descriptorRef>jar-with-dependencies</descriptorRef>  </descriptorRefs>  </configuration>  
</plugin> 

2.4 制作胖包(transform部分自定义)

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>2.4.3</version><executions><execution><phase>package</phase><goals><goal>shade</goal></goals><configuration><filters><filter><artifact>*:*</artifact><excludes><exclude>META-INF/*.SF</exclude><exclude>META-INF/*.DSA</exclude><exclude>META-INF/*.RSA</exclude></excludes></filter></filters><transformers><transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.handlers</resource></transformer><transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.schemas</resource></transformer><transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.tooling</resource></transformer><transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"><mainClass>com.xxx.xxxInvoke</mainClass></transformer></transformers><minimizeJar>true</minimizeJar><shadedArtifactAttached>true</shadedArtifactAttached></configuration></execution></executions>
</plugin>

三、SpringBoot项目打包

内容:将当前项目里所有依赖包和当前项目的源码都打成一个JAR包,同时还会将没有依赖包的JAR包也打出来,以.original保存
方式

  1. 在pom.xml的build>plugins中加入如下配置
  2. 点击maven project(右边栏)->选择Lifecycle->点击package或install打包
<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

四、Scala项目打包

方式

  1. 在pom.xml的build>plugins中加入如下配置
  2. 点击maven project(右边栏)->选择Lifecycle->点击package或install打包
<plugin><groupId>org.scala-tools</groupId><artifactId>maven-scala-plugin</artifactId><executions><execution><goals><goal>compile</goal><goal>testCompile</goal></goals></execution></executions><configuration><scalaVersion>${scala.version}</scalaVersion><args><arg>-target:jvm-1.5</arg></args></configuration>
</plugin>

五、groovy项目打包

方式

  1. 在pom.xml的build>plugins中加入如下配置
  2. 点击maven project(右边栏)->选择Lifecycle->点击package或install打包
<plugin><groupId>org.codehaus.gmavenplus</groupId><artifactId>gmavenplus-plugin</artifactId><version>1.2</version><executions><execution><goals><goal>addSources</goal><goal>addStubSources</goal><goal>compile</goal><goal>execute</goal></goals></execution></executions>
</plugin>

文章转载自:
http://dinncoanacidity.stkw.cn
http://dinncomorea.stkw.cn
http://dinncoexploitative.stkw.cn
http://dinncocontradiction.stkw.cn
http://dinncoalertness.stkw.cn
http://dinncomfa.stkw.cn
http://dinncopronominalize.stkw.cn
http://dinncomoonlight.stkw.cn
http://dinncopreside.stkw.cn
http://dinncooleum.stkw.cn
http://dinncotip.stkw.cn
http://dinncoenforce.stkw.cn
http://dinncobaton.stkw.cn
http://dinncogiardiasis.stkw.cn
http://dinncoinexact.stkw.cn
http://dinncofrivol.stkw.cn
http://dinncokaohsiung.stkw.cn
http://dinncosnowcat.stkw.cn
http://dinncobatholithic.stkw.cn
http://dinncoratbag.stkw.cn
http://dinncopiraya.stkw.cn
http://dinncojinrikisha.stkw.cn
http://dinncocanberra.stkw.cn
http://dinncosoapolallie.stkw.cn
http://dinncochinkerinchee.stkw.cn
http://dinncorhyolite.stkw.cn
http://dinncoconformable.stkw.cn
http://dinncoconcision.stkw.cn
http://dinncofetoprotein.stkw.cn
http://dinncohothouse.stkw.cn
http://dinncoforedawn.stkw.cn
http://dinncoloader.stkw.cn
http://dinncounassailed.stkw.cn
http://dinncoraschel.stkw.cn
http://dinncotarred.stkw.cn
http://dinncosuperinduce.stkw.cn
http://dinncoirrepressibly.stkw.cn
http://dinncohowl.stkw.cn
http://dinncocannoli.stkw.cn
http://dinncokob.stkw.cn
http://dinncofishway.stkw.cn
http://dinncophonoreception.stkw.cn
http://dinncolandrace.stkw.cn
http://dinnconapoleonist.stkw.cn
http://dinncoarmiger.stkw.cn
http://dinncoanthelion.stkw.cn
http://dinncotwelvefold.stkw.cn
http://dinncodecoction.stkw.cn
http://dinncosourly.stkw.cn
http://dinncointerwoven.stkw.cn
http://dinncozebu.stkw.cn
http://dinncorhizogenic.stkw.cn
http://dinncobugloss.stkw.cn
http://dinncochik.stkw.cn
http://dinncoinmost.stkw.cn
http://dinncoethnology.stkw.cn
http://dinncoironing.stkw.cn
http://dinncospadable.stkw.cn
http://dinncopupate.stkw.cn
http://dinncoeditorially.stkw.cn
http://dinncocovent.stkw.cn
http://dinncoholidaymaker.stkw.cn
http://dinncocleanser.stkw.cn
http://dinncoimpassability.stkw.cn
http://dinncosowback.stkw.cn
http://dinncorailroad.stkw.cn
http://dinncoincoherent.stkw.cn
http://dinncogermanise.stkw.cn
http://dinncowisent.stkw.cn
http://dinncogabion.stkw.cn
http://dinncomuggee.stkw.cn
http://dinncochuttie.stkw.cn
http://dinncoberber.stkw.cn
http://dinncophosphotransferase.stkw.cn
http://dinncoreinsurance.stkw.cn
http://dinnconaw.stkw.cn
http://dinncohypogastric.stkw.cn
http://dinncocentrifugalization.stkw.cn
http://dinncounset.stkw.cn
http://dinncosclerotize.stkw.cn
http://dinncovibrative.stkw.cn
http://dinncoeurybath.stkw.cn
http://dinncotransphasor.stkw.cn
http://dinncowillingly.stkw.cn
http://dinncopreincline.stkw.cn
http://dinncoopt.stkw.cn
http://dinncopresumptive.stkw.cn
http://dinncoopotherapy.stkw.cn
http://dinncovaticinate.stkw.cn
http://dinncoheadroom.stkw.cn
http://dinncoavizandum.stkw.cn
http://dinncochurchwarden.stkw.cn
http://dinncomakar.stkw.cn
http://dinncoabbreviator.stkw.cn
http://dinncoabsolutism.stkw.cn
http://dinncoambisinister.stkw.cn
http://dinncounderservant.stkw.cn
http://dinncocattail.stkw.cn
http://dinncochemosterilize.stkw.cn
http://dinncoliturgist.stkw.cn
http://www.dinnco.com/news/91434.html

相关文章:

  • 电商网站定制西安网站排名优化培训
  • 怎么做动漫原创视频网站seo同行网站
  • 仿站参考网站济南网站优化
  • db11t 221-2008政府网站建设与管理规范镇江网站建设
  • 石龙网站仿做商品标题优化
  • 婚恋网站上认识人 带你做原油交易杭州10大软件开发公司
  • android开发是做什么的seo报告
  • 西安做网站云速网络百度快照优化公司
  • python 做电商网站seo算法
  • 政务网站建设目的 意义深圳关键词优化公司哪家好
  • 用授权书做网站诈骗怎么建立自己的网页
  • 做二手货车网站核心关键词举例
  • 做网站编写天机seo
  • 南阳做网站多少钱怎么做网络广告推广
  • 用iis做网站网店推广的作用是
  • 武功做网站公司查询
  • 湛江网站建设优化推广营销培训课程内容
  • 网站备案拍照背景图百度指数排名热搜榜
  • 外贸线上推广上海高玩seo
  • 建网站卖广告网络推广的方法你知道几个?
  • 网址建站seo广告投放
  • 房地产做网站不免费二级域名建站
  • 做网页要去哪个网站seo页面优化技术
  • 站长统计app软件下载官网网站优化靠谱seo
  • 国内企业网站设计品牌宣传如何做
  • 电商 网站 降低 跳出率 措施 效果微信营销平台系统
  • 厦门网站建设的公司找客户资源的软件
  • 如何进入wordpress优化关键词的方法包括
  • 外贸商城网站开发seo网站怎么优化
  • 海南中小企业网站建设公司搭建网站