zoukankan      html  css  js  c++  java
  • maven打包插件:appassembler

    1.打包成bat

    打包命令:mvn clean package appassembler:assemble

    <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>appassembler-maven-plugin</artifactId>
                    <version>1.2.1</version>
                    <configuration>
                        <!-- 生成linux, windows两种平台的执行脚本 -->
                        <platforms>
                            <platform>windows</platform>
                            <platform>unix</platform>
                        </platforms>
                        <!-- 根目录 -->
                        <assembleDirectory>${project.build.directory}/mall</assembleDirectory>
                        <!-- 打包的jar,以及maven依赖的jar放到这个目录里面 -->
                        <repositoryName>lib</repositoryName>
                        <!-- 可执行脚本的目录 -->
                        <binFolder>bin</binFolder>
                        <!-- 配置文件的目标目录 -->
                        <configurationDirectory>conf</configurationDirectory>
                        <!-- 拷贝配置文件到上面的目录中 -->
                        <copyConfigurationDirectory>true</copyConfigurationDirectory>
                        <!-- 从哪里拷贝配置文件 (默认src/main/config) -->
                        <configurationSourceDirectory>src/main/resources</configurationSourceDirectory>
                        <!-- lib目录中jar的存放规则,默认是${groupId}/${artifactId}的目录格式,flat表示直接把jar放到lib目录 -->
                        <repositoryLayout>flat</repositoryLayout>
                        <encoding>UTF-8</encoding>
                        <logsDirectory>logs</logsDirectory>
                        <tempDirectory>tmp</tempDirectory>
                        <programs>
                            <program>
                                <!-- 启动类 -->
                                <mainClass>net.test.App</mainClass>
                                <jvmSettings>
                                    <extraArguments>
                                        <extraArgument>-server</extraArgument>
                                        <extraArgument>-Xmx2G</extraArgument>
                                        <extraArgument>-Xms2G</extraArgument>
                                    </extraArguments>
                                </jvmSettings>
                            </program>
                        </programs>
                    </configuration>
                </plugin>

    2.打包成系统服务

    打包命令:mvn clean package appassembler:generate-daemons
    Usage: { console | start | stop | restart | status | dump }

    <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>appassembler-maven-plugin</artifactId>
                    <version>1.2.1</version>
                    <configuration>
                        <!-- 根目录 -->
                        <assembleDirectory>${project.build.directory}/mall</assembleDirectory>
                        <!-- 打包的jar,以及maven依赖的jar放到这个目录里面 -->
                        <repositoryName>lib</repositoryName>
                        <!-- 可执行脚本的目录 -->
                        <binFolder>bin</binFolder>
                        <!-- 配置文件的目标目录 -->
                        <configurationDirectory>conf</configurationDirectory>
                        <!-- 拷贝配置文件到上面的目录中 -->
                        <copyConfigurationDirectory>true</copyConfigurationDirectory>
                        <!-- 从哪里拷贝配置文件 (默认src/main/config) -->
                        <configurationSourceDirectory>src/main/resources</configurationSourceDirectory>
                        <!-- lib目录中jar的存放规则,默认是${groupId}/${artifactId}的目录格式,flat表示直接把jar放到lib目录 -->
                        <repositoryLayout>flat</repositoryLayout>
                        <encoding>UTF-8</encoding>
                        <logsDirectory>logs</logsDirectory>
                        <tempDirectory>tmp</tempDirectory>
                        <daemons>
                            <daemon>
                                <mainClass>net.test.App</mainClass>
                                <platforms>
                                    <platform>jsw</platform>
                                </platforms>
                                <generatorConfigurations>
                                    <generatorConfiguration>
                                        <generator>jsw</generator>
                                        <includes>
                                            <include>linux-x86-32</include>
                                            <include>linux-x86-64</include>
                                            <include>windows-x86-32</include>
                                            <include>windows-x86-64</include>
                                        </includes>
                                        <configuration>
                                            <property>
                                                <name>configuration.directory.in.classpath.first</name>
                                                <value>conf</value>
                                            </property>
                                            <property>
                                                <name>wrapper.ping.timeout</name>
                                                <value>120</value>
                                            </property>
                                            <property>
                                                <name>set.default.REPO_DIR</name>
                                                <value>lib</value>
                                            </property>
                                            <property>
                                                <name>wrapper.logfile</name>
                                                <value>logs/wrapper.log</value>
                                            </property>
                                        </configuration>
                                    </generatorConfiguration>
                                </generatorConfigurations>
                                <jvmSettings>
                                    <!-- jvm参数 -->
                                    <systemProperties>
                                        <systemProperty>com.sun.management.jmxremote</systemProperty>
                                        <systemProperty>com.sun.management.jmxremote.port=1984</systemProperty>
                                        <systemProperty>com.sun.management.jmxremote.authenticate=false</systemProperty>
                                        <systemProperty>com.sun.management.jmxremote.ssl=false</systemProperty>
                                    </systemProperties>
                                </jvmSettings>
                            </daemon>
                        </daemons>
                    </configuration>
                </plugin>

    注意:1.2.1没有id这个属性。

  • 相关阅读:
    Tomcat集群Cluster实现原理剖析[转] 文件同步
    看到一个比较好的jbpm教程,感谢一下
    vi显示行号
    安装apache2参数详解
    Windows平台下查看占用端口的程序
    struts2中使用token避免重复提交
    在window下安装开源的中文界面的项目管理软件Redmine
    Java中数据存储
    求素数算法网摘
    模式工程化实现及扩展读书笔记——设计原则
  • 原文地址:https://www.cnblogs.com/huiy/p/6165239.html
Copyright © 2011-2022 走看看