Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Compose Playground
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Briar Staging
Compose Playground
Commits
14ee86fa
Commit
14ee86fa
authored
4 years ago
by
Alexey Tsvetkov
Committed by
Alexey Tsvetkov
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Document suggestModules task
parent
4769b2f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tutorials/Native_distributions_and_local_execution/README.md
+33
-6
33 additions, 6 deletions
tutorials/Native_distributions_and_local_execution/README.md
with
33 additions
and
6 deletions
tutorials/Native_distributions_and_local_execution/README.md
+
33
−
6
View file @
14ee86fa
...
...
@@ -15,7 +15,8 @@ without requiring an installed JDK on the target system.
[
Jlink
](
https://openjdk.java.net/jeps/282
)
will take care of bundling only the necessary Java Modules in
the distributable package to minimize package size,
but you must still configure the Gradle plugin to tell it which modules you need.
but you must still configure the Gradle plugin to tell it which modules you need
(see the
`Configuring included JDK modules`
section).
## Basic usage
...
...
@@ -43,7 +44,6 @@ compose.desktop {
mainClass
=
"example.MainKt"
nativeDistributions
{
modules
(
"java.sql"
)
targetFormats
(
TargetFormat
.
Dmg
,
TargetFormat
.
Msi
,
TargetFormat
.
Deb
)
}
}
...
...
@@ -72,10 +72,37 @@ Note, that the tasks are created only if the `application` block/property is use
After a build, output binaries can be found in
`${project.buildDir}/compose/binaries`
.
At this time, the Gradle plugin does not automatically determine the JDK Modules necessary to run, and you must manually
determine the specific modules you need and include them in
`modules()`
. Failure to provide the necessary modules
will not cause compilation issues, but will lead to
`ClassNotFoundException`
at runtime. See issue #463 for more context
and how to determine the modules you need to include.
## Configuring included JDK modules
The Gradle plugin uses
[
jlink
](
https://openjdk.java.net/jeps/282
)
to minimize a distributable size by
including only necessary JDK modules.
At this time, the Gradle plugin does not automatically determine necessary JDK Modules.
Failure to provide the necessary modules will not cause compilation issues,
but will lead to
`ClassNotFoundException`
at runtime.
If you encounter
`ClassNotFoundException`
when running a packaged application or
`runDistributable`
task, you can include additional JDK modules using
`modules`
DSL method (see example below).
You can determine, which modules are necessary either by hand or by running
`suggestModules`
task.
`suggestModules`
uses the
[
jdeps
](
https://docs.oracle.com/javase/9/tools/jdeps.htm
)
static analysis tool to determine possible missing modules. Note, that the output of the tool
might be incomplete or list unnecessary modules.
If a distributable size is not critical, you may simply include all runtime modules as an alternative
by using
`includeAllModules`
DSL property.
```
kotlin
compose
.
desktop
{
application
{
nativeDistributions
{
modules
(
"java.sql"
)
// alternatively: includeAllModules = true
}
}
}
```
## Available formats
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment