• IDEA导出JAR包


    进入Project Structure > Artifacts -- 添加 > JAR > From modules with dependencies.... 

    导出为可执行JAR需要设置Main Class,作为JAR程序入口.

    一般工具JAR可以不设置Main Class.

    选择extract to the target JAR 会将所有buildpath中的JAR引用都打在一个JAR中

    选择copt to the output directory and link via manifest会按照.MF文件中自定义的格式来打包

     .MF完整示例

    Manifest-Version: 1.0
    Class-Path: jcl-over-slf4j-1.7.13.jar jackson-databind-2.8.0.jar sprin
     g-data-commons-1.11.4.RELEASE.jar spring-expression-4.0.4.RELEASE.jar
      junit-3.8.1.jar spring-tx-4.0.4.RELEASE.jar commons-beanutils-1.8.3.
     jar mybatis-spring-1.2.2.jar ojdbc14-10.2.0.1.0.jar itext-2.1.7.jar j
     ackson-mapper-asl-1.9.13.jar spring-beans-4.0.4.RELEASE.jar commons-l
     ogging-1.2.jar commons-dbcp-1.4.jar freemarker-2.3.20.jar mybatis-3.2
     .8.jar jsf-impl-1.2_04.jar spring-aop-4.0.4.RELEASE.jar log4j-1.2.17.
     jar druid-1.0.23.jar spring-context-support-4.1.6.RELEASE.jar commons
     -collections-3.2.1.jar aopalliance-1.0.jar ehcache-core-2.6.8.jar bcm
     ail-jdk14-138.jar jackson-annotations-2.8.0.jar mybatis-ehcache-1.0.3
     .jar spring-core-4.1.4.RELEASE.jar commons-fileupload-1.2.2.jar poi.j
     ar jstl-1.2.jar itext-2.1.7.jar junit-3.8.1.jar druid-1.0.23.jar log4
     j-1.2.17.jar mybatis-3.2.8.jar commons-io-2.4.jar fastjson-1.2.3.jar 
     itextpdf-5.5.4.jar jsf-api-1.2_04.jar aopalliance-1.0.jar jsf-impl-1.
     2_04.jar bcmail-jdk14-138.jar bcprov-jdk14-138.jar bctsp-jdk14-1.38.j
     ar commons-dbcp-1.4.jar slf4j-api-1.7.13.jar bcmail-jdk14-1.38.jar bc
     prov-jdk14-1.38.jar commons-lang3-3.4.jar freemarker-2.3.20.jar commo
     ns-pool-1.5.4.jar ehcache-core-2.6.8.jar jackson-core-2.8.0.jar ojdbc
     14-10.2.0.1.0.jar aspectjweaver-1.8.4.jar commons-logging-1.2.jar myb
     atis-spring-1.2.2.jar jcl-over-slf4j-1.7.13.jar mybatis-ehcache-1.0.3
     .jar jackson-databind-2.8.0.jar commons-beanutils-1.8.3.jar jackson-c
     ore-asl-1.9.13.jar javax.servlet-api-3.0.1.jar spring-tx-4.0.4.RELEAS
     E.jar commons-fileupload-1.2.2.jar spring-aop-4.0.4.RELEASE.jar sprin
     g-web-4.0.4.RELEASE.jar commons-collections-3.2.1.jar jackson-annotat
     ions-2.8.0.jar jackson-mapper-asl-1.9.13.jar spring-core-4.1.4.RELEAS
     E.jar spring-jdbc-4.0.4.RELEASE.jar spring-test-4.0.4.RELEASE.jar spr
     ing-beans-4.0.4.RELEASE.jar spring-webmvc-4.0.4.RELEASE.jar spring-co
     ntext-4.0.4.RELEASE.jar spring-expression-4.0.4.RELEASE.jar spring-da
     ta-commons-1.11.4.RELEASE.jar spring-context-support-4.1.6.RELEASE.ja
     r itextpdf-5.5.4.jar commons-lang3-3.4.jar bctsp-jdk14-1.38.jar jstl-
     1.2.jar bcprov-jdk14-138.jar spring-jdbc-4.0.4.RELEASE.jar spring-web
     -4.0.4.RELEASE.jar poi.jar spring-webmvc-4.0.4.RELEASE.jar bcmail-jdk
     14-1.38.jar javax.servlet-api-3.0.1.jar jsf-api-1.2_04.jar commons-po
     ol-1.5.4.jar bcprov-jdk14-1.38.jar fastjson-1.2.3.jar jackson-core-2.
     8.0.jar slf4j-api-1.7.13.jar commons-io-2.4.jar spring-test-4.0.4.REL
     EASE.jar jackson-core-asl-1.9.13.jar aspectjweaver-1.8.4.jar spring-c
     ontext-4.0.4.RELEASE.jar
    Main-Class: 

     配置好后,通过 Build > Build Artifacts 选择配置的JAR, build ebuild;JAR文件会被创建在输出文件夹中.

  • 相关阅读:
    scrapy+splash 爬取京东动态商品
    分布式文件系统HDFS 练习
    爬取全部的校园新闻
    字符串操作、文件操作,英文词频统计预处理
    了解大数据的特点、来源与数据呈现方式
    EF常用的添加和修改数据
    ASP.NET Core快速入门(第5章:认证与授权)
    ASP.NET Core MVC 项目在IIS中部署
    Cookiebased认证实现
    ASP.NET Core中的授权(3) — 基于自定义策略
  • 原文地址:https://www.cnblogs.com/sknn/p/8203678.html
Copyright © 2020-2023  润新知