maven 自动生成运行脚本插件appassembler-maven-plugin

appassembler-maven-plugin可以自动生成跨平台的启动脚本,省去了手工写脚本的麻烦,而且还可以生成jsw的后台运行程序。 appassembler的配置比较简单,在pom.xml的配置文件加入插件配置。 比如说不同的启动脚本,可以如下配置

  
  
  
  
  1. <plugin> 
  2.                 <groupId>org.codehaus.mojo</groupId> 
  3.                 <artifactId>appassembler-maven-plugin</artifactId> 
  4.                 <version>1.2.1</version> 
  5.                 <configuration> 
  6.                     <configurationDirectory>conf</configurationDirectory> 
  7.                     <configurationSourceDirectory>src/main/resources</configurationSourceDirectory> 
  8.                     <copyConfigurationDirectory>true</copyConfigurationDirectory> 
  9.                     <includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath> 
  10.                     <assembleDirectory>${project.build.directory}/chj-search-client</assembleDirectory> 
  11.                     <extraJvmArguments>-Xms128m</extraJvmArguments> 
  12.                     <binFileExtensions> 
  13.                         <unix>.sh</unix> 
  14.                     </binFileExtensions> 
  15.                     <platforms> 
  16.                         <platform>windows</platform> 
  17.                         <platform>unix</platform> 
  18.                     </platforms> 
  19.                     <repositoryName>lib</repositoryName> 
  20.                     <programs> 
  21.                         <program> 
  22.                             <mainClass>com.chj360.search.client.App</mainClass> 
  23.                         </program> 
  24.                     </programs> 
  25.                 </configuration> 
  26.             </plugin> 

然后运行maven命令 :mvn package appassembler:assemble 就可以自动生成整个的依赖文件,配置文件和运行脚本了。 一些配置说明 configurationDirectory:生成配置文件路径 configurationSourceDirectory:配置文件原路径,默认为src/main/config assembleDirectory:整体包目录 extraJvmArguments:jvm参数 binFileExtensions:生成脚本的后缀 platforms:生成哪几种平台 repositoryName:依赖包目录,默认repo programs:这个必须参数,启动的主class

 

转自:http://lavafree.iteye.com/blog/1502594

你可能感兴趣的:(maven,maven-plugins,appassembler)