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插件生成启动脚本的更多相关文章

  1. Jboot使用appassembler-maven-plugin插件生成启动脚本

    appassembler-maven-plugin介绍: 使用appassembler-maven-plugin插件可自动生成跨平台的启动脚本,可省去手工写脚本的麻烦,而且还可以生成jsw的后台运行程 ...

  2. 使用appassembler插件生成启动脚本

    appassemblermaven插件可以自动生成跨平台的启动脚本,省去了手工写脚本的麻烦,而且还可以生成jsw的后台运行程序.插件官网:http://www.mojohaus.org/appasse ...

  3. Maven plugin插件---appassembler-maven-plugin快速配置

    使用appassembler-maven-plugin 打包自定义目录 1.Pom中添加 <plugin> <artifactId>maven-resources-plugin ...

  4. eclipse maven plugin 插件 安装 和 配置

      离线插件 点击下载离线安装包:eclipse-maven-plugin.zip ( for eclipse helios or higher ) .解压缩到任意目录(如这里的plugins目录): ...

  5. Maven plugin 插件

    1.maven-surefire-plugin简介: Maven在构件时执行到测试的生命周期时,会使用maven-surefire-plugin运行测试用例,背后执行的Junit或者TestNG的测试 ...

  6. (转)淘淘商城系列——使用maven tomcat插件启动聚合工程

    http://blog.csdn.net/yerenyuan_pku/article/details/72672389 上文我们一起学习了如何使用maven tomcat插件来启动web工程,本文我们 ...

  7. (转)淘淘商城系列——使用maven tomcat插件启动web工程

    http://blog.csdn.net/yerenyuan_pku/article/details/72672138 上文我们一起学习了怎样搭建maven工程,这篇文章我就来教大家一起学习怎样用to ...

  8. Maven常用插件

    maven利用各种插件来管理构建项目,本文记录下工作中常用到的插件及使用方法.每个插件都会提供多个目标(goal),用于标示任务.各插件配置在pom.xml里,如下: <build> [. ...

  9. Spring Boot Maven Plugin(二):run目标

    简介 Spring Boot Maven Plugin插件提供spring boot在maven中的支持.允许你打包可运行的jar包或war包. 插件提供了几个maven目标和Spring Boot ...

随机推荐

  1. 配置OpenVpn使用证书和用户名密码双验证

    修改OpenVpn的主配置文件 添加一下内容: [root@check1 openvpn]# tail -3 server.conf auth-user-pass-verify /etc/openvp ...

  2. HDU 1337 && POJ 1218&& zju 1350 方法总结

    题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1337 杭电 http://poj.org/problem?id=1218清华 http://acm.zj ...

  3. linux 挂在新硬盘

    记录一下    全忘了..... PS 测试服务器的主板太差劲了,没有多余的电源接口,只能把光驱的电源拿出来,才能让硬盘使用.把硬盘装好后,我们用 fdisk -l 查看下: 图中可以看出 /dev/ ...

  4. MFC 任务管理器设计

    在学习界面设计,因为对一些控件不熟悉,所以也参考了别人的.核心代码如下. void CTasklistDlg::Expand() { m_list.SetExtendedStyle(LVS_EX_GR ...

  5. Valid sudoku, 是否是有效的数独

    问题描述:给定9x9矩阵,看是是否是有效数独,不用全部都填上数字,可以为. 算法分析:这道题就是判断,不难,有效数独三个充分条件,行,列,3*3子矩阵,都要满足数字不能重复. public boole ...

  6. Java中使用Log的方法

    一.java自带log:java.util.logging.Logger使用三步曲 public class HelloLogWorld { private static String name = ...

  7. RegularExpressions(正则表达式)

    最近在不少地方用到了正则表达式,一直对这一块不太熟悉,今天写一些关于正则表达式的知识,一来是总结自己学的知识,二来今后忘记了可以及时的复习. 在java中想应用正则表达式带来的好处,必须先了解两个类, ...

  8. 各种WEB服务器自带的默认Servlet名称

    Tomcat, Jetty, JBoss, and GlassFish 自带的默认Servlet的名字 -- "default" Google App Engine 自带的 默认S ...

  9. MySQL备份与恢复实战案例及生产方案

    按天备份 按周备份 mysql的mysqldump备份什么时候能派上用场1,迁移或者升级数据库时2,增加从库的时候3,如果因为硬件或特殊情况,主库或者从库宕机,主从可以互相切换,无需备份4,人为的DD ...

  10. 常见GAN的应用

    深入浅出 GAN·原理篇文字版(完整)|干货 from:http://baijiahao.baidu.com/s?id=1568663805038898&wfr=spider&for= ...