使用appassembler-maven-plugin插件生成启动脚本
appassembler-maven-plugin可以自动生成跨平台的启动脚本,省去了手工写脚本的麻烦,而且还可以生成jsw的后台运行程序。
首先pom引入相关依赖
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.src.version}</source>
<target>${java.target.version}</target>
<encoding>UTF-</encoding>
</configuration>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.bosssoft.platform.appframe.mobile.TestAuth</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build> <profiles>
<profile>
<id>appassembler</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<!-- Generate both Windows and Linux bash shell execution scripts -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
<configuration>
<repositoryLayout>flat</repositoryLayout>
<useWildcardClassPath>true</useWildcardClassPath>
<!-- Set the target configuration directory to be used in the bin scripts -->
<configurationDirectory>conf</configurationDirectory>
<!-- Copy the contents from "/src/main/config" to the target configuration
directory in the assembled application -->
<copyConfigurationDirectory>true</copyConfigurationDirectory>
<!-- Include the target configuration directory in the beginning of
the classpath declaration in the bin scripts -->
<includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
<!-- Extra JVM arguments that will be included in the bin scripts -->
<repositoryName>lib</repositoryName>
<extraJvmArguments>-Xmx1024m -Djava.net.preferIPv4Stack=true -Dfile.encoding=utf-</extraJvmArguments>
<programs>
<program>
<id>main</id>
<mainClass>com.bosssoft.platform.appframe.mobile.TestAuth</mainClass>
<name>main</name>
</program>
</programs>
<binFileExtensions>
<unix>.sh</unix>
</binFileExtensions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
注:红色标注的内容改成,main所在的程序类路径
然后运行maven命令 :mvn package appassembler:assemble 或者mvn clean install即可
就可以自动生成整个的依赖文件,配置文件和运行脚本了。
相关配置说明:
configurationDirectory:生成配置文件路径
configurationSourceDirectory:配置文件原路径,默认为src/main/config
assembleDirectory:整体包目录
extraJvmArguments:jvm参数
binFileExtensions:生成脚本的后缀
platforms:生成哪几种平台
repositoryName:依赖包目录,默认repo
programs:这个必须参数,启动的主class
使用appassembler-maven-plugin插件生成启动脚本的更多相关文章
- Jboot使用appassembler-maven-plugin插件生成启动脚本
appassembler-maven-plugin介绍: 使用appassembler-maven-plugin插件可自动生成跨平台的启动脚本,可省去手工写脚本的麻烦,而且还可以生成jsw的后台运行程 ...
- 使用appassembler插件生成启动脚本
appassemblermaven插件可以自动生成跨平台的启动脚本,省去了手工写脚本的麻烦,而且还可以生成jsw的后台运行程序.插件官网:http://www.mojohaus.org/appasse ...
- Maven plugin插件---appassembler-maven-plugin快速配置
使用appassembler-maven-plugin 打包自定义目录 1.Pom中添加 <plugin> <artifactId>maven-resources-plugin ...
- eclipse maven plugin 插件 安装 和 配置
离线插件 点击下载离线安装包:eclipse-maven-plugin.zip ( for eclipse helios or higher ) .解压缩到任意目录(如这里的plugins目录): ...
- Maven plugin 插件
1.maven-surefire-plugin简介: Maven在构件时执行到测试的生命周期时,会使用maven-surefire-plugin运行测试用例,背后执行的Junit或者TestNG的测试 ...
- (转)淘淘商城系列——使用maven tomcat插件启动聚合工程
http://blog.csdn.net/yerenyuan_pku/article/details/72672389 上文我们一起学习了如何使用maven tomcat插件来启动web工程,本文我们 ...
- (转)淘淘商城系列——使用maven tomcat插件启动web工程
http://blog.csdn.net/yerenyuan_pku/article/details/72672138 上文我们一起学习了怎样搭建maven工程,这篇文章我就来教大家一起学习怎样用to ...
- Maven常用插件
maven利用各种插件来管理构建项目,本文记录下工作中常用到的插件及使用方法.每个插件都会提供多个目标(goal),用于标示任务.各插件配置在pom.xml里,如下: <build> [. ...
- Spring Boot Maven Plugin(二):run目标
简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...
随机推荐
- 无网络环境用pip安装python类包
1.现在有网络的电脑安装相应的包 pip install django 2.安装完成后 打包 1)新建一个文件夹(package),用来存放包: 2)执行 pip list #查看安装的包 pip f ...
- python中set的用处
python中有很多不同的数据结构,比如list,tuple,set,dic等,为什么我要单独讲set呢. 因为set是一个比较容易被遗忘的数据结构,不光在python中,在C++中也一样,反正我是很 ...
- redhat 6.8 配置yum源
一般安装好redhat后,不能注册的话,不能使用系统自带的yum源.但是我们可以自己配置yum源来解决这一问题.下面介绍下redhat配置163yum源. 1. 检查是否安装yum包 rpm -qa ...
- [USACO08DEC]在农场万圣节Trick or Treat on the Farm
题目描述 Every year in Wisconsin the cows celebrate the USA autumn holiday of Halloween by dressing up i ...
- php源码之appveyor
打开appveyor目录 是4个bat文件 1. .bat是什么? bat文件是dos下的批处理文件.批处理文件是无格式的文本文件,它包含一条或多条命令. 它的文件扩展名为.bat或.cmd 在命令提 ...
- T-SQL RIGHT JOIN
RIGHT JOIN外联接与LEFT JOIN相似.取得右表所有记录,并按过滤条件ON去取得左表的记录,取得这些记录,如遇上没有匹配的列使用NULL填充. 演示数据来源,两张表来自http://www ...
- python time 和 datetime 模块的简介
时间处理 time 和 datetime import timeimport datetimeprint time.time() #时间戳显示为1508228106.49print time.strf ...
- 将DLL注册到GAC
使用方法如下: 方法1: (1).开始菜单->Microsoft Visual Studio 2010 ->Visual Studio Tools->Visual Studio Co ...
- 交叉编译工具链介绍《Building Embedded Linux Systems》
1.前言 配置和编译一个合适的GNU工具链是相对复杂的并且需要很精细的操作,包括你需要对不同软件库之间的依赖关系.它们的各自的任务,不同软件库版本情况都有比较好的了解,编译工具链是一个乏味的工作. 2 ...
- CoreData / MagicalRecord
CoreData 之前在学习使用SQLite时, 需要编写大量的sql语句,完成数据的增删改查,但对于不熟悉sql语句的开发人员来说,难度较大,调试程序比较困难.由此出现CoreData框架,将sql ...