8

I am trying to create a custom panel for an IzPack installer. This means that I have to extend IzPanel. However, it appears that if I do this, the extended panel needs to be in the com.izforge.izpack.panels package.

Then I found this post, which stipulates that:

  1. As such, you must include installer.jar from the lib folder of IzPack in the build path of your custom panel project.
  2. Your custom panel /must/ extend com.izforge.izpack.installer.IzPanel.
  3. Furthermore, it /must/ reside in the com.izforge.izpack.panels package.
  4. On top of it all, your build jar's name /must/ be the same as the unqualified name of your custom panel class.

I take issue with the 1st and 4th points. They imply that I have to create an additional JAR file for each custom IzPanel that I create. Also, I would have to modify the IzPack installation by adding these JARs to one of its subdirectories.

Is this article outdated (2008) and can it be safely ignored, or is this still true?
If not how can I avoid this and simply have the extended IzPanel on the classpath instead?

Thank you!

4

2 回答 2

2

好的,我认为您希望将面板放在您自己的包装中的单个罐子中。

这就是你的做法:

  1. 使用所有自定义面板创建您的 jar
  2. 将该 jar 复制到 IzPackStagingFolder\bin\panels
  3. 编辑安装程序描述符并在面板部分下引用您的 CustomPanels.jar

然后在 install.xml 中定义面板部分,类似于:

...
<panels>
    <panel classname="HTMLInfoPanel"          id="infopanel" encoding="ISO-8859-1" />
    <panel classname="TargetPanel"            id="targetpanel" />
    <panel classname="com.myCompany.installer.panels.MyCustomPanelOne"     id="customPanelOne" jar="bin/panels/CustomPanels.jar" />
    <panel classname="UserInputPanel"         id="userInputPanel" />
    <panel classname="InstallPanel"           id="installPanel" />
    <panel classname="ProcessPanel"           id="processPanel" />
    <panel classname="com.myCompany.installer.panels.MyCustomPanelTwo"   id="customPanelTwo" jar="bin/panels/CustomPanels.jar" />
    <panel classname="FinishPanel"            id="finishPanel" />
</panels>
...

CustomPanels.jar 可以是单个 maven 项目,在您自己的包中包含您自己的面板,其中两个类 CustomPanelOne 和 CustomPanelTwo 都扩展了 IzPanel。

有关更多信息,请参阅https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/491534/Creating+Panels上的 IzPack 较旧的 4.x 文档。截至目前,较新的 IzPack 5.x 文档 wiki 缺少此部分。

另请参阅https://github.com/izpack/izpack/blob/4.3/src/dtd/installation.dtd上的 XML DTD

于 2012-11-16T23:28:31.237 回答
0

除了 Paul Bors 在这里回答之外,还有一点。

IzPacks 4.x 只需要 installer.jar 作为依赖项。当我第一次尝试使用installer.jar (izpack-installer-5.0.0-beta11.jar) 编译自定义面板时,发现很多编译错误。Izpack 5.0 增加了对 IzPack api (izpack-api-5.0.0-beta11.jar) 和 Izpack gui(izpack-gui-5.0.0-beta11.jar) 的额外依赖。

享受创建自定义面板的乐趣。

于 2013-04-10T10:54:42.103 回答