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

Fix dockerfile setup resources #940

Merged

Conversation

rorueda
Copy link
Contributor

@rorueda rorueda commented Feb 6, 2024

Use lazy evaluation of the layers' files to avoid triggering dependency resolution during configuration.

After upgrading to 4.3.1, I started getting the error below during configuration - the message is a bit misleading, but I think the stack points to the root cause.

An exception occurred applying plugin request [id: 'java-platform']
> Failed to apply plugin 'org.gradle.java-platform'.
   > Project#afterEvaluate(Action) on project ':bom' cannot be executed in the current context.

org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'java-platform']
	...
	at org.gradle.api.internal.file.CompositeFileCollection.isEmpty(CompositeFileCollection.java:66)
	at io.micronaut.gradle.docker.MicronautDockerfile.setupResources(MicronautDockerfile.java:228)
	at io.micronaut.gradle.docker.MicronautDockerfile.setupInstructions(MicronautDockerfile.java:137)
	at io.micronaut.gradle.docker.MicronautDockerfile.setupTaskPostEvaluate(MicronautDockerfile.java:170)
	at io.micronaut.gradle.docker.MicronautDockerPlugin.lambda$createDockerImage$21(MicronautDockerPlugin.java:173)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
	at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
	at org.gradle.internal.code.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:122)
	at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction$1.run(DefaultCollectionCallbackActionDecorator.java:110)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
	at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction.execute(DefaultCollectionCallbackActionDecorator.java:107)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection$AbstractDomainObjectCreatingProvider.configure(DefaultNamedDomainObjectCollection.java:909)
	at io.micronaut.gradle.docker.MicronautDockerPlugin.lambda$createDockerImage$22(MicronautDockerPlugin.java:171)
	at io.micronaut.gradle.docker.MicronautDockerPlugin.lambda$createDockerImage$23(MicronautDockerPlugin.java:171)
	at io.micronaut.gradle.docker.MicronautDockerPlugin.lambda$withBuildStrategy$24(MicronautDockerPlugin.java:186)
	...

Use lazy evaluation of the layers' files to avoid triggering
dependency resolution during configuration.
@melix
Copy link
Collaborator

melix commented Feb 6, 2024

Thanks for the PR. However it seems curious that you have the problem on a bom project. It sounds as if the Micronaut plugins are applied on this project, which shouldn't be the case, right?

@rorueda
Copy link
Contributor Author

rorueda commented Feb 6, 2024

That is why I thought the message is so misleading. The only plugins applied to the bom are java-platform and com.google.osdetector, but the project for which I actually executed the tasks task applies the micronaut.application and has the bom as a dependency. I tested removing the bom, but then I had the same error on other plugins.

@melix melix added this to the 4.3.2 milestone Feb 7, 2024
@melix melix merged commit a2409ff into micronaut-projects:master Feb 7, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants