利用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. [转]Oracle10g数据库自动诊断监视工具(ADDM)使用指南

    第一章 ADDM简介                 在Oracle9i及之前,DBA们已经拥有了很多很好用的性能分析工具,比如,tkprof.sql_trace.statspack.set even ...

  2. 复选框css

    input, select, button, textarea{ -webkit-appearance:none; }该属性会导致复选框失去选择效果

  3. ORACLE_UNQNAME

    之前在自己笔记本win7系统上安装了oracle 11g,当时为了节省资源,没启用EM. 此时查看EM状态: C:\Windows\system32>emctl status dbconsole ...

  4. r-cnn学习(九):学习总结

    首先看下代码文件夹的说明(这部分转自:http://blog.csdn.net/bailufeiyan/article/details/50749694) tools 在tools文件夹中,是我们直接 ...

  5. ajax简单应用

    var xmlhttp;if (window.XMLHttpRequest) { // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码 xmlhttp=new ...

  6. dex文件格式三

    先来看看整体的结构,结构体定义在DexFile.h里面   在dexFileSetupBasicPointers中设置各个子结构体,当然是在解析DexHeader之后 源码在DexFile.c文件中 ...

  7. 【Network】OVS VXLAN/GRE 实践

    参考资料: OVS/VXLAN/GRE参考 ovs vxlan IP overray_百度搜索 OVS操作总结-Neutron-about云开发 OpenStack OVS GRE/VXLAN网络_z ...

  8. pwd命令

    [pwd]      打印当前的工作目录             pwd==print work director 命令格式: pwd [OPTION]... 命令功能: 打印当前工作目录的全路径 命 ...

  9. VS2013 密钥 – 所有版本

    Visual Studio Ultimate 2013 KEY(密钥):BWG7X-J98B3-W34RT-33B3R-JVYW9 Visual Studio Premium 2013 KEY(密钥) ...

  10. C# winform 跨线程更改窗体控件的属性

    当winform程序中新开一个线程,是无法改变主线程中窗体控件的属性的,否则运行时会报错. 若想在其他线程中控制主线程中的窗体控件,则必须利用BeginInvoke方法. 例如:添加一个名为textb ...