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:
- As such, you must include installer.jar from the lib folder of IzPack in the build path of your custom panel project.
- Your custom panel /must/ extend com.izforge.izpack.installer.IzPanel.
- Furthermore, it /must/ reside in the com.izforge.izpack.panels package.
- On top o开发者_StackOverflowf 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!
Okay, I take it you want to have your panels in a single jar within your own package.
This is how you do it:
- Create your jar with all of your custom panels
- Copy that jar to the IzPackStagingFolder\bin\panels
- Edit the installer descriptor and under the panels sections reference your CustomPanels.jar
Then inside your install.xml you define your panels sections similar to:
...
<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>
...
Where CustomPanels.jar can be a single maven project with your own panels in your own package with two classes CustomPanelOne and CustomPanelTwo both extending IzPanel.
For more info see IzPack's older 4.x documentation at https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/491534/Creating+Panels. As of right now the newer IzPack 5.x doc wiki is missing this section.
Also reffer to the XML DTD at https://github.com/izpack/izpack/blob/4.3/src/dtd/installation.dtd
One more point in addition to Paul Bors answer here.
IzPacks 4.x needed only installer.jar as dependency. When i first tried to compile the custom panel with installer.jar (izpack-installer-5.0.0-beta11.jar), found many compilation errors. Izpack 5.0 adds additional dependency on IzPack api (izpack-api-5.0.0-beta11.jar) and Izpack gui(izpack-gui-5.0.0-beta11.jar).
Enjoy creating custom panels.
精彩评论