利用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. css中margin的应用

    1.margin用于设置外边距,没有继承性,父元素设置的margin属性子元素不会继承. 2.margin存在重叠的问题. 水平边距永远不会发生重叠. 垂直边距在特定情况下会重叠. 重叠问题都很容易解 ...

  2. HTTP缓存

    本文是<HTTP权威指南>读书笔记 Web缓存是可以自动保存常见文档副本的设备.当Web请求抵达缓存时,如果本地在“已缓存”的的副本,就可以从本地存储设备而不是原始服务器中提取这个文档.使 ...

  3. Jquery 轮播图简易框架

    =====================基本结构===================== <div class="carousel" style="width: ...

  4. 引用类型的转换问题和instanceof

    基本数据类型:  

  5. C# I/O

    获取运行时的动态目录 private static string GetDataDir_Data() { var parent = Directory.GetParent(Directory.GetC ...

  6. 最新Mac OS X 10.12.1 安装cocoapods及使用详解

    cocoapods官网:https://cocoapods.org 一.什么是CocoaPods 每种语言发展到一个阶段,就会出现相应的依赖管理工具,例如 Java 语言的 Maven,nodejs ...

  7. html图标插件

    https://bitbucket.org/cleonello/jqplot/downloads/ 下载地址 http://www.cnblogs.com/yaozhenfa/p/jqplot-pie ...

  8. Jade 模板引擎使用

    在 Express 中调用 jade 模板引擎 jade 变量调用 if 判断 循环 Case 选择 在模板中调用其他语言 可重用的 jade 块 (Mixins) 模板包含 (Includes) 模 ...

  9. j嵌入式f_os之定时管理

    /* * jf_timer.h * * Created on: Aug 20, 2016 * Author: lort */ #ifndef JF_OS_JF_TIMER_H_ #define JF_ ...

  10. 数据库SQL语句优化小结

    网上查找的总结: 1.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索引而进行全表扫描,如: select id from t where num is null ...