利用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. socket 函数

    1.创建套接字并返回一个描述符,该描述符可以用来访问套接字 #include<sys/types.h> #include<sys/socket.h>  int socket(i ...

  2. 释放修改OS X 10.11系统文件权限【转】

    序言:有时要替换相关的(系统目录下的)文件以完成软件的破解,但在 OS X 10.11 系统图形界面下,Root(系统超级用户)已‘转变’为 Administrator(管理员用户),选择系统文件夹( ...

  3. Android——SharedPreferences

    SharedPreferences是一种轻型的Android数据存储方式,用来保存应用的一些常用配置. 实现SharedPreferences存储的步骤如下: 1.根据Context获取SharedP ...

  4. spark 官方文档(1)——提交应用程序

    Spark版本:1.6.2 spark-submit提供了在所有集群平台提交应用的统一接口,你不需要因为平台的迁移改变配置.Spark支持三种集群:Standalone.Apache Mesos和Ha ...

  5. nexus的使用

    一.在百度网盘或官网下载nexus,并部署.   注意修改: https://repository.apache.org/content/repositories/releases/    二.下载m ...

  6. 搭建consul 集群

    1.   准备工作 a)      启动三台虚拟机 s1:10.1.7.141 s2:10.1.7.139 s3:10.1.7.138 b)      每台机器上在 /home新建文件夹 mkdir ...

  7. python的反转(切片)

    看下面代码吧,简单来说不如直接看代码.如下: #coding=utf-8 __author__ = 'debude' a = 'python' print a[::-1] #从最后n开始,每走一位都打 ...

  8. PHP 文件夹操作「复制、删除、查看大小」递归实现

    PHP虽然提供了 filesize.copy.unlink 等文件操作的函数,但是没有提供 dirsize.copydir.rmdirs 等文件夹操作的函数(rmdir也只能删除空目录).所以只能手动 ...

  9. excel链接sharepoint 用于 Excel 的 Microsoft Power Query

    https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=39379

  10. 通过挂载系统光盘搭建本地yum仓库的方法

    在CentOS系统中,我们常常会安装大量的软件,但许多软件包都存在需要依赖性,当然我们可以通过一一安装依赖包来完成安装,但对于有些软件包需要大量的依赖包,再一一安装起来会显得特别麻烦.接下来我们就来讲 ...