利用Maven的appassembler-maven-plugin插件,就可以实现自动打包可运行的脚本,还可以跨平台。
 
<plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>appassembler-maven-plugin</artifactId>
        <version>1.1.1</version>
        <configuration>
          <repositoryLayout>flat</repositoryLayout>
          <repositoryName>lib</repositoryName>
          <configurationSourceDirectory>src/main/resources/conf</configurationSourceDirectory>
          <!-- 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>
           <!-- prefix all bin files with "mycompany" -->
           <binPrefix>startup</binPrefix>
           <!-- set alternative assemble directory -->
           <assembleDirectory>${project.build.directory}/server</assembleDirectory>
           <!-- Extra JVM arguments that will be included in the bin scripts -->
           <extraJvmArguments>-Xms768m -Xmx768m -XX:PermSize=128m
             -XX:MaxPermSize=256m -XX:NewSize=192m -XX:MaxNewSize=384m
           </extraJvmArguments>
           <!-- Generate bin scripts for windows and unix pr default -->
           <platforms>
             <platform>windows</platform>
             <platform>unix</platform>
           </platforms>
           <programs>
             <program>
                 <mainClass>com.coderli.onecoder.server.HypervisorServer</mainClass>
               <name>startup</name>
               </program>
           </programs>
     </configuration>
</plugin>
 
然后选择要编译的工程,右键->maven build… 命令如下图:
 
package appassembler:assemble
 
然后执行run,一个可执行的脚本文件就生成好了。startup.bat是windows下的,startup.sh是linux下的
 
 

Maven打包生成可运行bat/sh脚本文件的更多相关文章

  1. 【Maven学习】Maven打包生成普通jar包、可运行jar包、包含所有依赖的jar包

    http://blog.csdn.net/u013177446/article/details/54134394 ******************************************* ...

  2. Maven将java项目打包生成可运行jar

    Maven将java项目打包生成可运行jar Maven插件配置 <plugins> <plugin> <groupId>org.apache.maven.plug ...

  3. 【Maven学习】Maven打包生成包含所有依赖的jar包

    http://blog.csdn.net/u013177446/article/details/54134583 ******************************************* ...

  4. maven的几个重要配置文件pom.xml、settings.xml;Maven打包生成包含所有依赖的jar包

    一个java项目通过maven自动下载依赖时,会涉级读取三个配置文件,分别是项目下的pom.xml 文件 .用户家目录下的.m2/settings.xml 与 maven 全局配置settings.x ...

  5. rac_进行grid自检时提示运行runfixup.sh脚本一例

    原创作品,出自 "深蓝的blog" 博客,欢迎转载,转载时请务必注明下面出处,否则追究版权法律责任. 深蓝的blog:http://blog.csdn.net/huangyanlo ...

  6. sh脚本文件的运行

    sh脚本文件的运行mac终端下运行shell脚本 1.写好自己的 脚本,比如test-bash.sh 2.打开终端 执行,方法一: 输入命令 ./test-bash.sh , 方法二:直接把 aa.s ...

  7. RAC安装GI时运行root.sh脚本结果

    第一节点运行root.sh脚本的结果: # /u01/app//grid/root.sh Performing root user operation for Oracle 11g The follo ...

  8. linux执行sh脚本文件命令

    linux执行sh脚本文件命令 很多时候需要多个命令来完成一项工作,而这个工作又常常是重复的,这个时候我们自然会想到将这些命令写成sh脚本,下次执行下这个脚本一切就都搞定了,下面就是发布代码的一个脚本 ...

  9. 网站卡死,照惯例运行.bat批量处理文件进行重启不起作用

    网站卡死,照惯例运行.bat批量处理文件进行重启不起作用,进入虚拟机控制台进行虚拟机重启仍然不起作用,通过ping分析物理服务器能ping通,各个虚拟机之前也能ping通,但是不能ping通外部,分析 ...

随机推荐

  1. php 全局变量

    参考链接:http://www.cnblogs.com/borage/p/3645285.html

  2. java大并发数据保存方案

    做了几年.net,如今终于要做java了. 需求: 线下终端会定时上传gps位置到服务端,服务端收到数据保存到mysql数据库,当线下终端过多时,问题出现了,首当其冲的是数据库连接池经常会崩溃,单个t ...

  3. maven学习(上)- 基本入门用法

    一.下载及安装 1.1 下载maven 3.1.1 先到官网http://maven.apache.org/download.cgi 下载最新版本(目前是3.1.1 ),下载完成后,解压到某个目录(本 ...

  4. 阿里云windows 2012服务器部署java web程序教程

    一:环境搭建 1.首先需要购买一个阿里云ECS服务器,购买时可以选择处理器核数以及内存大小(可以购买偏低配置,因为升级      方便) 2.购买后会自动创建一个实例,可以使用该实例中显示的公网地址在 ...

  5. POJ 2823 Sliding Window 线段树区间求和问题

    题目链接 线段树区间求和问题,维护一个最大值一个最小值即可,线段树要用C++交才能过. 注意这道题不是求三个数的最大值最小值,是求k个的. 本题数据量较大,不能用N建树,用n建树. 还有一种做法是单调 ...

  6. 【Juicer】 一个高效、轻量的前端 (Javascript) 模板引擎

    引用地址:http://juicer.name/docs/docs_zh_cn.html * 一个完整的例子 HTML 代码: <script id="tpl" type=& ...

  7. OpenGL glMultMatrixf() glPushMatrix() glPushMatrix()浅析

    我在之前的博客中曾提到过,OpenGL中坐标是采用行向量表示的,与之相对应的是,在矩阵变换中使用的是变换矩阵的转置,并且使用的是后乘的方式.本文直接使用下面的代码来及其后的图示来解释函数 p,li { ...

  8. 461. Hamming Distance and 477. Total Hamming Distance in Python

    题目: The Hamming distance between two integers is the number of positions at which the corresponding ...

  9. android 决解启动屏白黑屏会延迟几秒的问题

    通常写启动屏,都有个很不喜欢的问题,就是会空白几秒才显示界面,而且界面还是很简单的! 解决办法 1 写一个透明的主题,一般启动屏都是不要bar的所以继承AppTheme.NoActionBar < ...

  10. "_OBJC_CLASS_$_CMMotionManager", referenced from:

    好久没写随笔了,今日项目爆红.如下: 缺少系统库 CoreMotion.framework, 在Build Phases -> Link Binary With Libraries 中添加即可.