我使用5.0.0-rc4作为izpack版本,izpack-installer
工件作为我的pom.xml中的依赖项存在。
<dependency>
<groupId>org.codehaus.izpack</groupId>
<artifactId>izpack-installer</artifactId>
<version>${izpack.version}</version>
</dependency>
我为DeletePreviousInstallationAction
定义了自定义操作InstallPanel
。
InstallPanel定义包含在install.xml中,如下所示。
<panels>
<panel classname="TargetPanel"/>
<panel classname="UserInputPanel" id="panelUserInput"/>
<panel classname="InstallPanel">
<actions>
<action stage="preconstruct" classname="com.x.y.z.w.DeletePreviousInstallationAction" />
</actions>
</panel>
<panel classname="ProcessPanel"/>
<panel classname="SimpleFinishPanel"/>
</panels>
DeletePreviousInstallationAction
代码:
package com.x.y.z.w;
import com.izforge.izpack.api.data.InstallData;
import com.izforge.izpack.api.data.PanelActionConfiguration;
import com.izforge.izpack.api.handler.AbstractUIHandler;
import com.izforge.izpack.data.PanelAction;
public class DeletePreviousInstallationAction implements PanelAction {
@Override
public void executeAction(InstallData id, AbstractUIHandler auih) {
System.out.println("Intall path: " + id.getInstallPath());
}
@Override
public void initialize(PanelActionConfiguration pac) {
}
}
当我尝试构建安装项目时,我得到失败:找不到类'com.x.y.z.w.DeletePreviousInstallationAction'。为什么会这样?
答案 0 :(得分:0)
你很可能在编译过程中遗漏它,必须在“jar”部分添加它来安装xml的izpack,例如:
<jar src="@{jmx4ant:jmx4ant:jar}" stage="both" />