java 如何使用 Maven 创建安装程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1378129/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create installers with Maven
提问by Lóránt Pintér
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.
我正在将一个中型 Java 应用程序的构建从 Ant 迁移到 Maven。我可以轻松迁移基本的构建内容,但我也想从 Maven 构建创建安装程序包。最简单的方法是通过 Ant 插件调用原始 Ant 脚本,但我想也许我应该先四处看看一些 Maven 支持。
I'd need to create several different installers for different platforms:
我需要为不同的平台创建几个不同的安装程序:
- Windows 32/64 bit
- Linux 32/64 bit
- MacOS 32/64 bit
- 视窗 32/64 位
- Linux 32/64 位
- MacOS 32/64 位
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.
现在对于 Linux,我认为我们只有一个 tar.gz 和一些 Bash 脚本来启动守护进程——Debian/RPM 包会更好,也许还有依赖包定义。对于 Windows 安装程序,我们使用 NullSoft 安装程序。我不知道 MacOS 包现在是如何组装的。
Are there any tools out there to do this (or at least part of it) from Maven?
是否有任何工具可以从 Maven 执行此操作(或至少部分执行此操作)?
采纳答案by Rich Seller
I'd use the IzPack maven pluginif you need a full-blown installer, or the appassembler-maven-pluginif you simply need to generate daemons for java services.
如果您需要完整的安装程序,我会使用IzPack maven 插件,如果您只需要为 Java 服务生成守护程序,我会使用appassembler-maven-plugin。
There are also plugins for NSIS, Debian, and RPMpackaging, 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.
还有用于NSIS、Debian和RPM打包的插件,但使用这些意味着您必须维护每个平台的配置,另一方面,IzPack 允许您为 Windows XP / Vista / 2003 / 2000、Mac OS X 生成安装程序、Solaris、Linux 和 *BSD。
The appassembler plugin provides a goal to generate JSW daemons for each platform. Here is an example configuration:
appassembler 插件提供了为每个平台生成 JSW 守护程序的目标。这是一个示例配置:
<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>
回答by Kutzi
You could use IzPack and the IzPack maven plugin for that purpose. It works quite well for me: http://izpack.codehaus.org/izpack-maven-plugin/
为此,您可以使用 IzPack 和 IzPack maven 插件。它对我来说效果很好:http: //izpack.codehaus.org/izpack-maven-plugin/
回答by bastianneu
I am not sure if i get the question right. Have you ever tried maven assembly?
我不确定我的问题是否正确。你有没有尝试过 maven 程序集?
http://maven.apache.org/plugins/maven-assembly-plugin/
http://maven.apache.org/plugins/maven-assembly-plugin/
That was i my first idea for your question.
这是我对你的问题的第一个想法。
回答by Glen
回答by Kieveli
I'm looking into Installjammer - I don't see a maven plugin for it, but compared with izPack, it looks much more professional.
我正在研究 Installjammer - 我没有看到它的 maven 插件,但与 izPack 相比,它看起来更专业。
回答by Daniel Lopez
BitRock InstallBuildercan be used with Maven (and other CI build tools) to generate Windows exe installers, Linux binaries/RPM/DEB and OS X installers. It is commercial but we have discounts for small companies/solo developers and free licenses for open source projects (Disclaimer, I am the author of InstallBuilder)
BitRock InstallBuilder可以与 Maven(和其他 CI 构建工具)一起使用来生成 Windows exe 安装程序、Linux 二进制文件/RPM/DEB 和 OS X 安装程序。它是商业的,但我们为小公司/独立开发人员提供折扣,并为开源项目提供免费许可证(免责声明,我是 InstallBuilder 的作者)

