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. CodeIgniter 资料

    PHP 论坛: http://codeigniter.org.cn/forums/forum-opensource-1.html 下载 CodeIgniter 项目 的最新软件包(http://www ...

  2. css3+jQuery实现按钮水波纹效果

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name ...

  3. 深入理解Lambda

    概述 Lambda是一个表达式,也可以说它是一个匿名函数.然而在使用它或是阅读Lambda代码的时候,却显得并不那么容易.因为它匿名,因为它删减了一些必要的说明信息(比如方法名).下面就来说说Lamb ...

  4. 十一 web爬虫讲解2—Scrapy框架爬虫—Scrapy使用

    xpath表达式 //x 表示向下查找n层指定标签,如://div 表示查找所有div标签 /x 表示向下查找一层指定的标签 /@x 表示查找指定属性的值,可以连缀如:@id @src [@属性名称= ...

  5. 在web.xml中配置spring配置文件的路径

    <context-param>     <param-name>contextConfigLocation</param-name>     <param-v ...

  6. 详解 WebAPI 签名机制

    首先,写这篇文章的原因是因为最近某一个项目中的接口被人为调用了,导致了数据库数据被串改.虽然是内部人无意点的,但还是引起了我的担忧,所有整理了下关于WebAPI的相关签名机制. 一.我们在开发接口时, ...

  7. scrapy结构及各部件介绍

    1.总览,数据流图: 2.Engine:引擎负责控制系统所有组件之间的数据流,并在发生某些操作时触发事件. 3.Scheduler:调度程序接收来自引擎的请求,并将它们排入队列,并在之后,当Engin ...

  8. day13作业

    #作业1猜年龄 , 可以让用户最多猜三次! # Auther:bing #!/usr/bin/env python age = 24 print("猜年龄") for i in r ...

  9. LeetCode OJ:Valid Anagram(有效字谜问题)

    Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = &q ...

  10. Puzzle Game HihoCoder - 1634

    题目链接:https://cn.vjudge.net/problem/HihoCoder-1634 题目意思:可以让矩阵里的某一个数变成p,或者不修改.求最大子矩阵最小,输出最小值. 思路:请看下图 ...