Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
J

JavaPackager

> 包管理
Open source

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.

1.2K stars0 likes1 views
WebsiteGitHub

About

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.

JavaPackager

JavaPackager is a hybrid plugin for Maven and Gradle which provides an easy way to package Java applications in native Windows, MacOS or GNU/Linux executables, and generate installers for them.

[!IMPORTANT] See JavaPackager changes and fixes.

Project maintainers needed

This project has been actively maintained for many years, but due to lack of time, I can no longer dedicate the attention it deserves. To keep it alive and evolving, I’m looking for contributors to help with its maintenance.

:point_right: Join the discussion

Any help is welcome! Thank you for your support.

History

It was born while teaching to my students how to build and distribute their Java apps, and after seeing that a chain of several plugins was needed to achieve this task, I decided to develop a plugin :ring: to rule them all.

Apps packaged with JavaPackager

  • AstroImageJ
  • Astro Pixel Processor
  • GistFX
  • Spektar Design Lab

How to use this plugin

Package your app with Maven

Add the following plugin tag to your pom.xml:

xml

    io.github.fvarrui
    javapackager
    {latest.version}
    
        
            package
            
                package
            
            
                
                path.to.your.mainClass
                
                true|false
                true|false
                true|false
                auto|linux|mac|windows
                
                    file path
                    folder path
                    ...
                
                ...
                ...
                ...
                [...]
            
        
    

[!tip] See Maven plugin configuration samples to know more.

And execute the next command in project's root folder:

bash
mvn package

Package your app with Gradle

Apply JavaPackager plugin in build.gradle using legacy mode (because at the moment it's only available in Maven Central repository):

groovy
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'io.github.fvarrui:javapackager:{latest.version}'
    }
}

apply plugin: 'io.github.fvarrui.javapackager.plugin'

Create your packaging task:

groovy
task packageMyApp(type: io.github.fvarrui.javapackager.gradle.PackageTask, dependsOn: build) {
    // mandatory
    mainClass = 'path.to.your.mainClass'
    // optional
    bundleJre = true|false
    generateInstaller = true|false
    administratorRequired = true|false
    platform = "auto"|"linux"|"mac"|"windows"
    additionalResources = [ file('file path'), file('folder path'), ... ]
    linuxConfig {
        ...
    }
    macConfig {
        ...
    }
    winConfig {
        ...
    }
    ...
}

[!TIP] See Gradle plugin configuration samples to know more.

And execute the next command in project's root folder:

bash
gradle packageMyApp

Generated artifacts

By default it will generate next artifacts in ${outputDirectory} folder:

Artifact Description Platform Requires
${name} Directory with native application and other assets. All
${name}-${version}-runnable.jar Runnable JAR file. All
${name}_${version}.AppImage AppImage package file. GNU/Linux FUSE 2 to run the app.
${name}_${version}.deb DEB package file. All
${name}_${version}.rpm RPM package file. All
${name}_${version}.exe Setup file. Windows Inno Setup (iscc command must be in PATH variable)
${name}_${version}.msi MSI installer file. Windows WiX Toolset (candle and light commands must be in PATH variable)
${name}_${version}.msm MSI merge module file. Windows WiX Toolset ( candle and light commands must be in PATH variable)
${name}_${version}.dmg Disk image file (uses hdiutil). MacOS
${name}_${version}.pkg PKG installer file (uses pkgbuild). MacOS
${name}-${version}-${platform}.zip Zipball containing generated directory ${name}. All
${name}-${version}-${platform}.tar.gz Compressed tarball containing generated directory ${name}. All
assets Directory with all intermediate files generated by JavaPackager. All

[!TIP] Inno Setup and WiX Toolset installation guide.

Plugin configuration properties

Property Mandatory Default value Description
additionalModulePaths :x: [] Additional module paths for jdeps.
additionalModules :x: [] Additional modules to the ones identified by jdeps or the specified with modules property.
additionalResources :x: [] Additional files and folders to include in the bundled app.
arch :x: ${os.arch} The dependency of some ArtifactGenerator objects in the process of making packages, such as GenerateDeb
administratorRequired :x: false App will run as administrator (with elevated privileges).
assetsDir :x: ${basedir}/assets or ${projectdir}/assets Assets location (icons and custom Velocity templates).
bundleJre :x: false Embeds a customized JRE with the app.
classpath :x: List of additional paths to JVM classpath, separated with ; (recommended) or :.
copyDependencies :x: true Bundles all dependencies (JAR files) with the app.
createTarball :x: false Bundles app folder in tarball.
createZipball :x: false Bundles app folder in zipball.
customizedJre :x: true

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javadebdebian-packagesdistributiondmg

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category包管理
PricingOpen source

> Related tools

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image