如何使用Maven创建安装程序 [英] How to create installers with Maven

查看:113
本文介绍了如何使用Maven创建安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个中型Java应用程序的构建从Ant迁移到Maven。我可以轻松地迁移基本构建内容,但我还想从Maven构建中创建安装程序包。最简单的方法是通过Ant插件调用原始的Ant脚本,但我想也许我应该首先考虑一下Maven的支持。

I'm migrating a medium sized Java application's build from Ant to Maven. I could easily migrate the basic building stuff, but I would also like to create the installer packages from the Maven build. The easiest way would be to call the original Ant scripts through the Ant plugin, but I thought maybe I should look around first for some Maven support.

我需要为不同的平台创建几个不同的安装程序:

I'd need to create several different installers for different platforms:


  • Windows 32/64位

  • Linux 32/64 bit

  • MacOS 32/64位

对于Linux现在我认为我们只有一个焦油.gz和一些Bash脚本来启动守护进程 - Debian / RPM包会更好,可能还有依赖包定义。对于Windows安装程序,我们使用NullSoft安装程序。我不知道MacOS捆绑包现在如何组装。

For Linux now I think we only have a tar.gz and some Bash scripts to start the daemons - a Debian/RPM package would be much nicer, maybe with dependent package definitions, too. For the Windows installers we use NullSoft installer. I have no idea how the MacOS bundle is assembled now.

是否有任何工具可以从Maven那里(或者至少部分)完成这项工作?

Are there any tools out there to do this (or at least part of it) from Maven?

推荐答案

我会使用 IzPack maven插件插件/rel =nofollow noreferrer> appassembler-maven-plugin 如果你只需要为java服务生成守护进程。

I'd use the IzPack maven plugin if you need a full-blown installer, or the appassembler-maven-plugin if you simply need to generate daemons for java services.

还有 NSIS的插件 Debian RPM 打包,但使用这些方法你必须维护每个平台的配置,另一方面,IzPack允许你生成一个适用于Windows XP / Vista / 2003/2000,Mac OS X,Solaris,Linux和* BSD的安装程序。

There are also plugins for NSIS, Debian, and RPM packaging, but using those means you have to maintain configurations for each platform, on the other hand IzPack allows you to generate an installer for Windows XP / Vista / 2003 / 2000, Mac OS X, Solaris, Linux and *BSD.

appassembler插件提供了为每个平台生成JSW守护进程的目标。以下是配置示例:

The appassembler plugin provides a goal to generate JSW daemons for each platform. Here is an example configuration:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>appassembler-maven-plugin</artifactId>
  <version>1.0</version>
  <execution>
    <id>generate-jsw-scripts</id>
    <phase>package</phase>
    <goals>
      <goal>generate-daemons</goal>
    </goals>
    <configuration>
      <daemons>
        <daemon>
          <id>myApp</id>
          <mainClass>name.seller.rich.MainClass</mainClass>
          <commandLineArguments>
            <commandLineArgument>start</commandLineArgument>
          </commandLineArguments>
          <platforms>
            <platform>jsw</platform>
          </platforms>              
        </daemon>
      </daemons>
      <target>${project.build.directory}/appassembler</target>
    </configuration>
  </execution>
</plugin>

这篇关于如何使用Maven创建安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆