利用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. JAVA输入输出流

    概述: 各种流类型(类和抽象类)都位于位于java.io包中,各种流都分别继承一下四种抽象流中的一种: 类型 字节流 字符流 输入流 InputStream Reader 输出流 OutputStre ...

  2. 深入理解android:id以及@+id/name和@id/name的区别联系

    今天为了好好研究了下@+id/name和@id/name的区别以及联系,又翻了翻文档/guide/topics/resources/layout-resource.html中关于 android:id ...

  3. URI编码解码

    .NET string s= System.Web.HttpUtility.UrlEncode("123", System.Text.Encoding.Unicode); //编码 ...

  4. android3D动画,绕y轴旋转

    原文地址:http://blog.csdn.net/x_i_a_o_h_a_i/article/details/40449847 其实网上的3D旋转的例子很多,在这里我只是想把其代码做一个解释. 先上 ...

  5. 不得不说的wepapi 优化

    1:在你的ASP.NET Web API中使用GZIP 或 Deflate .对于减少响应包的大小和响应速度,压缩是一种简单而有效的方式.这是一个非常有必要使用的功能,你可以查看更多关于压缩的文章在我 ...

  6. Android搜索功能的案例,本地保存搜索历史记录......

    开发的APP有一个搜索功能,并且需要显示搜索的历史记录,我闲暇之余帮她开发了这个功能,现把该页面抽取成一个demo分享给大家. 实现效果如图所示:  本案例实现起来很简单,所以可以直接拿来嵌入项目中使 ...

  7. java注解处理

    1.自定义注解类型   package com.yc.annotation; import java.lang.annotation.ElementType; import java.lang.ann ...

  8. iOS三种正则表达式

    1.利用NSPredicate(谓词)匹配 例如匹配有效邮箱: NSString *email = @"nijino_saki@.com": NSString *regex = @ ...

  9. PowerDisner15 关于生成表带双""号问题

    我们可以尝试在DBMS配置文件中修改相应的格式来解决. 在PowerDesigner中 选择 Database->Edit current database->Script->Sql ...

  10. Android笔记:蓝牙

    if (!BTAdapter.isEnabled()) { //没有打开,就启动确认窗口询问用户是否打开 Intent i = new Intent(BluetoothAdapter.ACTION_R ...