MCPcopy Index your code
hub / github.com/apache/netbeans-nbpackage

github.com/apache/netbeans-nbpackage @nbpackage-1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release nbpackage-1.0 ↗ · + Follow
366 symbols 1,117 edges 37 files 150 documented · 41%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Apache NetBeans Packager (nbpackage)

nbpackage is a command line tool and library for packaging the NetBeans IDE or a NetBeans platform application into a native installer or package. It supports optional bundling of a Java runtime to make a self-contained application. It is inspired by the JDK's jpackage tool, but tailored to the needs of the IDE and RCP, with a different range of packagers, and some support for cross-platform package building.

Usage

Run nbpackage --help to see options.

While options for the packagers can be set on the command line, the easiest way is to use the support for a configuration file in Java Properties format.

Use the --save-config option to output all available options, or just the ones for a specific packager, to a properties file. Using a separate configuration file for each package type is the best option. The output file includes comments for each available option.

eg. to build an InnoSetup installer, first create the configuration file -

nbpackage --type windows-innosetup --save-config inno.properties

Edit the properties file, with package name, customized icons, path to Java runtime, etc. As well as the path to the native build tool. Paths can be prefixed with ${CONFIG}/ to be relative to configuration file location.

Then build the installer from the IDE / RCP zip using -

nbpackage --config inno.properties --input <PATH_TO_ZIP>

Use the --verbose option to see the output of the native packaging tools.

Template files

Most packagers use overridable templates, for build files, .desktop files, .plist files, etc. To save the existing templates for editing, use -

nbpackage --type <PACKAGE_TYPE> --save-templates <PATH_TO_FOLDER>

Edit the files, and add the paths to the relevant properties in the configuration file (using ${CONFIG}/ relative paths where appropriate).

Modifying the package image

nbpackage will first build an image - a directory with the correct layout and additional files for passing to the packaging tool. It is possible to use the --image-only and --input-image options to perform this in two separate passes to allow for customization of the process.

Supported packagers

--type linux-appimage

Create a Linux AppImage. Requires download of the AppImageTool, making it executable, and adding the path to the configuration file.

--type linux-deb

Create a Linux DEB package. Requires dpkg, dpkg-deb and fakeroot to be available on the system.

--type linux-rpm

Create a Linux RPM package. Requires rpm and rpmbuild to be available on the system.

--type macos-pkg

Create a macOS PKG installer. Requires swift to build the launcher, codesign if signing binaries, and pkgbuild to build the actual package.

If code signing identities are configured, the package will be signed, as well as all native binaries including those inside JAR files. The search patterns for native binaries and JAR files with native binaries can be adapted if necessary. The built package should then pass the Apple notarization process (submission and stapling must be done manually).

--type windows-innosetup

Create a Windows Inno Setup installer. Requires download of the installer tools, and adding the path to the iscc compiler to the packager configuration. See also further information on the iscc tool.

Inno Setup works well with Wine for building installers on other OS. Write a short shell script that invokes the iscc tool via wine and use this in the packager configuration - eg.

#!/bin/sh
wine C:\\Program\ Files\ \(x86\)\\Inno\ Setup\ 6\\ISCC.exe $1

--type zip

Mainly for debugging purposes, although can be used to bundle an RCP application with local runtime. As the IDE launcher does not yet support relative JDK location, this is less useful there.

Building from source

Building nbpackage requires JDK 21+. The project uses the Maven Wrapper. Building in the IDE or executing mvnw package will build the tool. Output can be found in target/nbpackage-<VERSION>/, as well as adjacent source and binary archives.

Run ./nbpackage-<VERSION>/bin/nbpackage --help to check.

Extension points exported contracts — how you extend this code

Packager (Interface)
API to be implemented by all packagers. [12 implementers]
src/main/java/org/apache/netbeans/nbpackage/Packager.java
Parser (Interface)
Parser to convert text value into option type. @param option type [1 implementers]
src/main/java/org/apache/netbeans/nbpackage/Option.java
Task (Interface)
Task API. A task only supports a single execution. Not all stages of the task may be executed - eg. when only creating a [1 …
src/main/java/org/apache/netbeans/nbpackage/Packager.java
JarProcessor (Interface)
Processor for updating files inside a JAR. For use with {@link FileUtils#processJarContents(java.nio.file.Path, java.lan
src/main/java/org/apache/netbeans/nbpackage/FileUtils.java

Core symbols most depended-on inside this repo

context
called by 114
src/main/java/org/apache/netbeans/nbpackage/AbstractPackagerTask.java
getValue
called by 71
src/main/java/org/apache/netbeans/nbpackage/Configuration.java
of
called by 46
src/main/java/org/apache/netbeans/nbpackage/Option.java
set
called by 33
src/main/java/org/apache/netbeans/nbpackage/Configuration.java
ofPath
called by 27
src/main/java/org/apache/netbeans/nbpackage/Option.java
ofString
called by 24
src/main/java/org/apache/netbeans/nbpackage/Option.java
find
called by 19
src/main/java/org/apache/netbeans/nbpackage/FileUtils.java
load
called by 18
src/main/java/org/apache/netbeans/nbpackage/Template.java

Shape

Method 319
Class 40
Interface 4
Enum 3

Languages

Java100%

Modules by API surface

src/main/java/org/apache/netbeans/nbpackage/AbstractPackagerTask.java25 symbols
src/main/java/org/apache/netbeans/nbpackage/macos/AppBundleTask.java24 symbols
src/main/java/org/apache/netbeans/nbpackage/rpm/RpmTask.java21 symbols
src/main/java/org/apache/netbeans/nbpackage/ArchiveUtils.java21 symbols
src/main/java/org/apache/netbeans/nbpackage/innosetup/InnoSetupTask.java20 symbols
src/main/java/org/apache/netbeans/nbpackage/ExecutionContext.java20 symbols
src/main/java/org/apache/netbeans/nbpackage/deb/DebTask.java18 symbols
src/test/java/org/apache/netbeans/nbpackage/AbstractPackagerTaskTest.java17 symbols
src/main/java/org/apache/netbeans/nbpackage/FileUtils.java17 symbols
src/main/java/org/apache/netbeans/nbpackage/Option.java15 symbols
src/main/java/org/apache/netbeans/nbpackage/Configuration.java15 symbols
src/main/java/org/apache/netbeans/nbpackage/appimage/AppImageTask.java14 symbols

For agents

$ claude mcp add netbeans-nbpackage \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page