使用以下pom和izpack不会执行安装程序jar

时间:2014-12-18 05:35:34

标签: maven izpack

我尝试使用maven制作一个izpack安装程序。我面临的问题是在构建中安装了' install.xml'而其他资源只是被复制到install.jar。 XML文件未被解析,因此install.jar没有被执行。

请帮助纠正问题。 pom.xml

`<groupId>org.codehaus.izpack</groupId>
    <version>5.0.0</version>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>izpack-dist-test-harness</artifactId>
    <name>IzPack dist module</name>
    <packaging>jar</packaging>


    <dependencies>
        <dependency>
            <groupId>org.codehaus.izpack</groupId>
            <artifactId>izpack-standalone-compiler</artifactId>
            <version>4.3.5</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.izpack</groupId>
            <artifactId>izpack-utils</artifactId>
            <version>5.0.0-beta5</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
    <finalName>${project.name}</finalName>
        <resources>
            <resource>
                <directory>src/main/izpack</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

        <plugins>

        <plugin>
                <groupId>org.codehaus.izpack</groupId>
                <artifactId>izpack-maven-plugin</artifactId>
                <version>1.0-alpha-5</version>
                <executions>
                    <execution>
                        <id>install</id>
                        <phase>package</phase>
                        <goals>
                            <goal>izpack</goal>
                        </goals>
                        <configuration>
                            <izpackBasedir>${staging.dir}</izpackBasedir>
                            <descriptor>install.xml</descriptor>
                            <installerFile>${project.build.directory}/${project.build.finalName}-install.jar</installerFile>
                        </configuration>
                    </execution>
                    </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.izpack</groupId>
                        <artifactId>izpack-standalone-compiler</artifactId>
                        <version>4.3.5</version>
                    </dependency>
                </dependencies>
        </plugin>

        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                </configuration>
        </plugin>
        <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.2</version>
                <executions>
                    <execution>
                        <id>copy-install-xml-parsed</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <encoding>UTF-8</encoding>
                            <overwrite>true</overwrite>
                            <outputDirectory>${staging.dir}</outputDirectory>
                            <delimiters>
                                <delimiter>@</delimiter>
                            </delimiters>
                            <resources>
                                <resource>
                                    <directory>src/main/izpack/</directory>
                                    <includes>
                                        <include>install.xml</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>${project.groupId}</groupId>
                <artifactId>izpack-maven-plugin</artifactId>
                <version>${project.version}</version>
                <configuration>
                </configuration>
            </plugin>
        </plugins>
    </build>'
    <properties>
        <staging.dir>${basedir}/target/staging</staging.dir>
    </properties>
</project>`

和install.xml的一部分:

<?xml version='1.0' encoding='iso-8859-1' standalone='yes' ?>
<installation version='1.0'>
<info>
    <!-- Info Params -->
</info>

<variables>
    <variable name="RESOURCEROOT" value="src/main/izpack"></variable>
</variables>

<guiprefs resizable="no" width="500" height="500">
    <modifier key="headingImageOnLeft" value="yes"/>
    <modifier key="labelGap" value="2"/>
    <modifier key="useHeadingPanel" value="yes"/>
    <modifier key="headingBackgroundColor" value="0x00ffffff"/>
</guiprefs>

<locale>
    <langpack iso3="eng"/>
    <langpack iso3="fra"/>
    <langpack iso3="spa"/>
</locale>

<resources>
    <res id="HTMLLicencePanel.licence" src="License.txt"/>
    <res id="InfoPanel.info" src="Readme.txt"/>
</resources>

<panels>
    <panel classname="HelloPanel"/>
    <panel classname="HTMLLicencePanel"/>
    <panel classname="InfoPanel"/>
    <panel classname="InstallPanel"/>
    <panel classname="FinishPanel"/>
</panels>

<conditon type="java" id="installonwindows">
    <java>
        <class>com.izforge.izpack.util.OsVersion</class>
        <field>IS_WINDOWS</field>
    </java>
    <returnvalue type="boolean">true</returnvalue>
</conditon>

<installerrequirements>
    <installerrequiremnet conditon="installonwindows" message="This installer can install only on windows"/>
</installerrequirements>

<packs>
    <pack name="Base" required="yes" preselected="yes">
        <description>The Base Files</description>
        <file src="Readme.txt" targetdir="$INSTALL_PATH" override="asktrue"/>
        <file src="Licence.txt" targetdir="$INSTALL_PATH" override="asktrue"/>
    </pack>
</packs>

任何帮助都将受到高度赞赏!谢谢!

0 个答案:

没有答案