• Java 打包


    1、maven update 项目

        选择Java项目,右键--maven -- update Maven Dependencies--OK

    2、打包前工程配置

    Following are the steps which I followed to resolve this issue:

    1. Create a resources folder in your src/main(ie src/main/resources)
    2. Create a META-INF folder in your src/main/resources
    3. Make MANIFEST.MF, spring.handlers and spring.schemas files under src/main/resources/META-INF.
    4. Paste the following in plugins section of your pom.xml
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-shade-plugin</artifactId>
     <version>1.4</version>
     <executions>
      <execution>
       <phase>package</phase>
           <goals>
              <goal>shade</goal>
           </goals>
       <configuration>
        <transformers>
         <transformer
       implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
          <mainClass> com.company.project.Main </mainClass>
         </transformer>
         <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>
        </transformers>
        <shadedArtifactAttached>true</shadedArtifactAttached>
        <!-- optional -->
        <shadedClassifierName>executable</shadedClassifierName>
         </configuration>
       </execution>
      </executions>
    </plugin>

    (参考)http://www.cnblogs.com/lhj588/archive/2012/03/23/2414318.html

    3、打包

       cmd 

       cd  Java项目跟目录下。

       maven clean

       maven package

    4、java -jar  打包好的Jar包, (运行程序)

        

  • 相关阅读:
    人心散了、项目必然要败(转自CSDN)
    sql server加锁机制
    数据库事物隔离级别
    aop学习
    数据库加锁(转)
    托管代码和非托管代码效率的对比。
    day05 Linux文本处理命令
    day04 CentOS 异常,问题解决方法
    day02 Linux系统介绍与安装
    linux常用命令的英文单词缩写
  • 原文地址:https://www.cnblogs.com/lhj588/p/2414341.html
Copyright © 2020-2023  润新知