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

compose desktop run task throws NullPointerException with gradle 6.6 or 6.7 #66

Closed
jbluntz opened this issue Nov 6, 2020 · 4 comments
Closed
Assignees

Comments

@jbluntz
Copy link

jbluntz commented Nov 6, 2020

Steps to recreate

  1. Open either multiplatform-template or desktop-template projects
  2. Update gradle/wrapper/gradle-wrapper.properties to gradle 6.6, 6.6.1, or 6.7
  3. Run :desktop:run

Error Log:

A problem occurred configuring project ':desktop'.
> Could not create task ':desktop:run'.
   > at index 0
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':desktop'.
Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':desktop:run'.
Caused by: java.lang.NullPointerException: at index 0
	at com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:225)
	at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:215)
	at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:209)
	at com.google.common.collect.ImmutableList.construct(ImmutableList.java:326)
	at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:243)
	at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection$UnresolvedItemsCollector.plus(DefaultConfigurableFileCollection.java:409)
	at org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection.from(DefaultConfigurableFileCollection.java:191)
	at org.jetbrains.compose.desktop.application.internal.ConfigureApplicationKt$configureRunTask$1.invoke(configureApplication.kt:159)
	at org.jetbrains.compose.desktop.application.internal.ConfigureApplicationKt$configureRunTask$1.invoke(configureApplication.kt)
	at org.jetbrains.compose.desktop.application.internal.ConfigureApplicationKt$composeTask$$inlined$apply$lambda$3.execute(configureApplication.kt:186)
	at org.jetbrains.compose.desktop.application.internal.ConfigureApplicationKt$composeTask$$inlined$apply$lambda$3.execute(configureApplication.kt)
@eygraber
Copy link
Contributor

eygraber commented Nov 6, 2020

I don't fully understand what app.mainJar is supposed to be doing so I wouldn't know what the best way to fix this is, but looking through the source, this seems to be the issue.

Starting from Gradle 6.0 DefaultConfigurableFileCollection.from will throw a NPE if there is a null element in the collection (ImmutableList.copyOf makes sure that elements aren't null).

app.mainJar is null, and is added to the collection. The next line calls from again (with app._fromFiles), and therefore throws an NPE, failing the build.

A possible fix is to replace cp.from(app.mainJar.orNull) with app.mainJar.orNull?.let(cp::from), but again, I'm not fully sure what that's supposed to be doing, so I'm not sure if that would break something else.

@ScottPierce
Copy link
Contributor

Seeing this same problem

@AlexeyTsvetkov
Copy link
Collaborator

Fixed in 56da868

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants