Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaPackager fails when I update javafx-gradle-plugin from 0.0.10 to 0.0.13 #291

Closed
2 of 5 tasks
Borewit opened this issue Feb 3, 2023 · 7 comments
Closed
2 of 5 tasks
Labels
bug Something isn't working fixed Issue fixed and release pending

Comments

@Borewit
Copy link

Borewit commented Feb 3, 2023

I'm not sure what I am submitting, maybe just a question...

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:

When I javafx-gradle-plugin 0.0.10 to 0.0.13 I can not longer pack the Windows installer.

I get the following exception:

Caused by: java.lang.UnsupportedOperationException
	at io.github.fvarrui.javapackager.packagers.BundleJre.getRequiredModules(BundleJre.java:258)
	at io.github.fvarrui.javapackager.packagers.BundleJre.doApply(BundleJre.java:114)
	at io.github.fvarrui.javapackager.packagers.ArtifactGenerator.apply(ArtifactGenerator.java:44)
	at io.github.fvarrui.javapackager.packagers.Packager.createApp(Packager.java:411)
	at io.github.fvarrui.javapackager.gradle.AbstractPackageTask.doPackage(AbstractPackageTask.java:45)

Which is thrown here:

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?
Please see the PR isolating the issue

To Reproduce

gradlew :packageMyApp

Please tell us about your environment:

  • JavaPackager version: 1.6.7
  • OS version: Windows
  • JDK version:
  • Build tool:
    • Maven
    • Gradle
@fvarrui
Copy link
Owner

fvarrui commented Feb 7, 2023

I've tried to package your app using the next environment:

------------------------------------------------------------
Gradle 7.3.3
------------------------------------------------------------

Build time:   2021-12-22 12:37:54 UTC
Revision:     6f556c80f945dc54b50e0be633da6c62dbe8dc71

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.5 (Eclipse Adoptium 17.0.5+8)
OS:           Windows 11 10.0 amd64

and managed to reproduce your error.

Then, tried to downgrade javafx-gradle-plugin to 0.0.10 and 0.0.8

    // https://github.com/openjfx/javafx-gradle-plugin
    id 'org.openjfx.javafxplugin' version '0.0.10'

but the error persists 😞

Caused by: java.lang.UnsupportedOperationException
        at io.github.fvarrui.javapackager.packagers.BundleJre.getRequiredModules(BundleJre.java:258)
        at io.github.fvarrui.javapackager.packagers.BundleJre.doApply(BundleJre.java:114)
        at io.github.fvarrui.javapackager.packagers.ArtifactGenerator.apply(ArtifactGenerator.java:44)
        at io.github.fvarrui.javapackager.packagers.Packager.createApp(Packager.java:411)
        at io.github.fvarrui.javapackager.gradle.AbstractPackageTask.doPackage(AbstractPackageTask.java:45)

@fvarrui
Copy link
Owner

fvarrui commented Feb 7, 2023

Later, after doing some research, I realized that the problem is because of the additional modules:

additionalModules = ['jdk.incubator.foreign', 'jdk.incubator.jpackage']

but ... why? Because I made the mistake of trying to add those additional modules to a fixed-size list returned by Arrays.asList(...):

modulesList = Arrays.asList(...);
[...]
modulesList.addAll(additionalModules);

If you try to remove those additional modules you will see that it's packaged successfully.

Another example: as you can see

public static void main(String[] args) {
    List<Integer> number = Arrays.asList(1, 2, 3);
    number.add(4);				
}

this code throws an UnsupportedOperationException:

Exception in thread "main" java.lang.UnsupportedOperationException
	at java.base/java.util.AbstractList.add(AbstractList.java:153)
	at java.base/java.util.AbstractList.add(AbstractList.java:111)
	at dad.game.demo.Main.main(Main.java:14)

Sorry for the inconveniences 😢 ... I'm going to fix it right now, and then you can package your app using 1.7.0-SNAPSHOT.

@fvarrui fvarrui added the bug Something isn't working label Feb 7, 2023
fvarrui added a commit that referenced this issue Feb 7, 2023
@fvarrui
Copy link
Owner

fvarrui commented Feb 7, 2023

I've just fixed this issue.

You have to build and install 1.7.0-SNAPSHOT to your local Maven repo:

git clone https://github.com/fvarrui/JavaPackager --branch devel
cd JavaPackager
gradlew publishToMavenLocal

Then update your build.gradle:

  • add mavenLocal() to buildscript.repositories
  • update classpath 'io.github.fvarrui:javapackager:1.6.7' to classpath 'io.github.fvarrui:javapackager:1.7.0-SNAPSHOT'

And finally gradlew :packageMyApp

Please, try it and give some feedback please.

@fvarrui fvarrui added the fixed Issue fixed and release pending label Feb 7, 2023
@fvarrui
Copy link
Owner

fvarrui commented Feb 8, 2023

JavaPackager 1.7.0 released to Maven Central

@fvarrui fvarrui closed this as completed Feb 8, 2023
kerner1000 pushed a commit to kerner1000/JavaPackager that referenced this issue Feb 8, 2023
@Borewit
Copy link
Author

Borewit commented Feb 8, 2023

Looks like io.github.fvarrui:javapackager 1.7.0 is working just fine, muchas gracias señor!

@fvarrui
Copy link
Owner

fvarrui commented Feb 8, 2023

Great news!! De nada 😅

@Borewit
Copy link
Author

Borewit commented Feb 8, 2023

Don't forget to push your v1.7.0 tag!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue fixed and release pending
Projects
None yet
Development

No branches or pull requests

2 participants