`
luhantu
  • 浏览: 203506 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Izpack Maven打包 第二篇

阅读更多

1.首先建立一个maven项目。

File - > New - > Other - > Maven Project 在打开的窗口直接next,选择maven-archetype-quickstart - > next,输入Group ID and Artifact ID - > Finished.

2.创建install.xml.

在src 下面创建izpack 文件夹(纯粹是一些原定俗称的东西),并在它的下面创建intall.xml。

内容可以从官网上找到,如下:

<?xml version="1.0" encoding="UTF-8"?>
<izpack:installation version="5.0"
                     xmlns:izpack="http://izpack.org/schema/installation"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://izpack.org/schema/installation http://izpack.org/schema/5.0/izpack-installation-5.0.xsd">
    <!-- 
        The info section.
        The meaning of the tags should be natural ...
    -->
    <info>
        <appname>Sample Installation</appname>
        <appversion>1.4 beta 666</appversion>
        <authors>
            <author name="JPz" email="jpz@superman.org"/>
            <author name="Hidden Man" email="hidden@hisdomain.com"/>
        </authors>
        <url>http://www.anotherworld-inspace-website.net/</url>
    </info>

    <!-- 
        The gui preferences indication.
        Sets the installer window to 640x480. It will not be able to change the size.
    -->
    <guiprefs width="640" height="480" resizable="yes"/>

    <!-- 
        The locale section.
        Asks here to include the English and French langpacks.
    -->
    <locale>
        <langpack iso3="eng"/>
        <langpack iso3="fra"/>
    </locale>

    <!-- 
        The resources section.
        The ids must be these ones if you want to use the LicencePanel and/or the InfoPanel.
    -->
    <resources>
        <res id="LicencePanel.licence" src="resource/Licence.txt"/>
        <res id="InfoPanel.info" src="resource/Readme.txt"/>
        <res id="userInputSpec.xml" src="userinput.xml" parse="yes" type="xml"/>
    </resources>

    <!-- 
        The panels section.
        We indicate here which panels we want to use. The order will be respected.
    -->
    <panels>
        <panel classname="HelloPanel"/>
        <panel classname="InfoPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/>
        <panel classname="UserInputPanel" id="panel1"></panel>
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="FinishPanel"/>
    </panels>

    <!-- 
        The packs section.
        We specify here our packs.
    -->
    <packs>
        <pack name="Base" required="yes">
            <description>The base files</description>
        </pack>
        <pack name="Docs" required="no">
            <description>The documentation</description>
        </pack>
        <pack name="Sources" required="no">
            <description>The sources</description>
        </pack>
    </packs>

</izpack:installation>

 在izpack下面创建resource文件夹,把Licence.txt 和Reamde.txt 放入。(可以随便生成连个txt文件)

3.创建自己的userinput.xml文件并放在izpack下面。

<izpack:userInput version="5.0"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:izpack="http://izpack.org/schema/userinput"
                  xsi:schemaLocation="http://izpack.org/schema/userinput http://izpack.org/schema/5.0/izpack-userinput-5.0.xsd">
		 <panel id="panel1">
		    <field type="staticText" align="left" txt="My comment is here." id="input.comment"/>
		    <field type="text" variable="proxyaddress">
		      <spec txt="Proxy Host:" id="input.proxy" size="25" set=""/>
		    </field>
		    <field type="text" variable="proxyPort">
		      <spec txt="Proxy Port:" id="input.port" size="6" set=""/>
		    </field>
		  </panel>
</izpack:userInput>

 4.修改pom文件夹。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.lombardrisk</groupId>
  <artifactId>izpack</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>izpack-maven-demo</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <izpack.staging>${project.build.directory}/staging</izpack.staging>
    <izpack.version>5.0.0-beta11</izpack.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  
  <build>
  	<plugins>
	    <plugin>
	    	<groupId>org.apache.maven.plugins</groupId>
	    	<artifactId>maven-antrun-plugin</artifactId>
	    	<version>1.7</version>
		    <executions>
		       <execution>
		          <id>generate-installer</id>
                  <phase>install</phase>
		          <goals>
		             <goal>run</goal>
		          </goals>
		          <configuration>
		             <tasks>
		                <copy todir="${izpack.staging}">
		                   <fileset dir="${basedir}/src/izpack"/>
		                </copy>
		             </tasks>
		          </configuration>
		       </execution>
		    </executions>
	 	</plugin>
  		<plugin>
            <groupId>org.codehaus.izpack</groupId>
            <artifactId>izpack-maven-plugin</artifactId>
            <version>${izpack.version}</version>
            <executions>
                <execution>
				 <id>1</id>
                    <phase>install</phase>
                    <goals><goal>izpack</goal></goals>
                    <configuration>
                         <baseDir>${izpack.staging}</baseDir>
                        <installFile>${basedir}/src/izpack/install.xml</installFile>
                        <jarName>installreport</jarName>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
			       <dependency>
			         <groupId>org.codehaus.izpack</groupId>
			         <artifactId>izpack-panel</artifactId>
			         <version>${izpack.version}</version>
			       </dependency>
			  </dependencies>
        </plugin>
  	</plugins>
  </build>
</project>

 5.至此完成准备工作。现在可以run maven命令了。

在cmd命令窗口中进入项目路径,然后输入命令 mvn clean install -U

运行成功后,就可以在target文件下看到installreport.jar,这就是生成出来的打包文件了。只是一个简单的demo,希望能帮助想学的人快速搭建起来这个环境。

 

 

 

0
0
分享到:
评论

相关推荐

    maven-izpack-plugin-0.3.1.jar

    maven-izpack-plugin-0.3.1.jar

    maven-izpack-plugin-0.3.0.jar

    maven-izpack-plugin-0.3.0.jar

    izpack source code 4.3.5

    2. **学习XML配置**:IzPack使用XML来定义安装流程,包括文件复制、用户输入、许可协议等。源代码将揭示如何解析和执行这些XML配置。 3. **自定义安装行为**:IzPack支持编写Java代码来扩展其功能,如自定义安装...

    izpack 入门指南

    izpack是开源的打包工具,这是他的入门操作指南

    IZpack使用心得

    #### 二、IZpack 特点及优势 1. **跨平台兼容性**:IZpack 支持多种操作系统,如 Windows、Linux 和 macOS,这使得开发人员可以轻松地为不同的平台创建一致的安装体验。 2. **高度可配置**:通过 XML 配置文件,...

    izpack-gui-5.0.0-beta10.zip

    【标题】"izpack-gui-5.0.0-beta10.zip" 是一个用于创建图形用户界面(GUI)安装程序的开源工具IzPack的版本。IzPack是一个强大的跨平台安装包制作工具,它允许开发者轻松创建具有专业外观和功能的安装程序,适用于...

    IzPack--强大的Java安装程序制作软件

    izpack是基于Apache Software License 2.0许可的开源项目;izpack是纯Java,对部分特性有针对不同平台版本的Library。例如:快捷键的创建。izpack是一个用于解决安装程序制作的Builder工具;通过izpack制作的安装...

    izpack-master_oracle_izpack_

    而Izpack是一款跨平台的安装包打包工具,能够帮助用户轻松创建和部署应用程序的安装程序。在Cent OS操作系统上安装Oracle数据库时,Izpack扮演着关键角色,简化了部署过程。本文将详细介绍如何在Cent OS系统中利用...

    IZPack 怎么使用

    IZPack 怎么使用IZPack 怎么使用IZPack 怎么使用IZPack 怎么使用IZPack 怎么使用IZPack 怎么使用IZPack 怎么使用IZPack 怎么使用

    IzPack-install-4.3.5

    IzPack-install-4.3.5

    izpack-dist-5.0.9.jar

    IzPack 是一个安装工具,具体介绍免去。 http://izpack.org/downloads/

    izpack-master

    can not down in company,so download it on home,then download it in company

    izpack-seed:种子应用程序来说明IzPack安装程序

    IzPack插图该项目可以作为为您的maven模块创建安装程序的示例Maven模块该示例项目的组织方式如下: izpack-seed+-application+-install| \-package| \-panel| \-installer应用模块在日志中显示参数的虚拟应用程序。...

    java文件打包

    7. **打包软件**:除了手动操作,开发者也经常使用专门的打包软件,如 Izpack 或 JSmooth,它们可以创建更高级的安装程序,如.exe文件,使得非开发人员也能方便地安装和运行Java应用程序。 8. **exe生成器**:...

    OpenSSH_gateway_config_izpack_gateway_

    IzPack是一个开源的安装打包工具,适用于Java应用程序。IzPack Gateway可能是指使用IzPack创建的一个特殊类型的入口点,用于管理和控制对远程系统的访问。IzPack可以创建自定义的安装程序,包括图形用户界面,帮助...

    p4java-2013.1.656196.zip

    2. **编写Izpack安装脚本**: 创建一个`.xml`文件,使用Izpack的XML语法定义安装过程。这个文件将包含程序信息、安装路径、许可协议、安装步骤等。 3. **配置Gradle任务**: 在`build.gradle`中配置Gradle任务,使其...

    izpack-native-5.0.0-beta8.zip

    【标题】"izpack-native-5.0.0-beta8.zip" 涉及的是 IzPack 的一个原生(native)组件的版本,IzPack 是一个流行且强大的 Java 安装包打包工具,用于创建跨平台的安装程序。这个特定的版本是 5.0.0 的 beta8 版本,...

    IzVerifier:IzPack 安装程序的静态规范验证

    IzPack 安装程序的静态规范文件验证。 目的 IzVerifier 是一种测试 izpack 安装程序是否存在错误定义或缺少规范的工具。 IzVerifier 还会解析安装程序使用的任何自定义类的源代码,以确保没有引用未定义的 izpack ...

Global site tag (gtag.js) - Google Analytics