maven项目 打可执行jar包

 

1、pom添加

<build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
          <!-- 主程序入口 -->
            <mainClass>com.abc.def.testcases.MainCase</mainClass> 
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
       <!--  去掉jar包名后面的后缀 -->
        <appendAssemblyId>false</appendAssemblyId>
      </configuration>
    </plugin>
  </plugins>
</build>
     

 

 

2、执行命令: mvn assembly:assembly   /  mvn clean compile assembly:single

 

http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven?page=1&tab=votes#tab-top

posted @ 2016-12-28 21:16  testway  阅读(889)  评论(0编辑  收藏  举报