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

Starting a new project in VS Code always fails on the first try #6819

Open
Artur- opened this issue Sep 26, 2024 · 1 comment
Open

Starting a new project in VS Code always fails on the first try #6819

Artur- opened this issue Sep 26, 2024 · 1 comment
Labels

Comments

@Artur-
Copy link
Member

Artur- commented Sep 26, 2024

Describe the bug

image
Failed to execute mojo com.vaadin:vaadin-maven-plugin:24.4.12:prepare-frontend {execution: default} (com.vaadin:vaadin-maven-plugin:24.4.12:prepare-frontend:default:process-resources)

org.eclipse.core.runtime.CoreException: Failed to execute mojo com.vaadin:vaadin-maven-plugin:24.4.12:prepare-frontend {execution: default}
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeMojo(MavenExecutionContext.java:404)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.lambda$2(MavenExecutionContext.java:355)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:354)
	at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:57)
	at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.lambda$2(MavenBuilderImpl.java:159)
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
	at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:139)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:164)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:109)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:292)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:100)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:278)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:83)
	at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:192)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.apache.maven.plugin.MojoFailureException: Could not execute prepare-frontend goal.
	at com.vaadin.flow.plugin.maven.PrepareFrontendMojo.execute(PrepareFrontendMojo.java:66)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
	at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeMojo(MavenExecutionContext.java:402)
	... 32 more
Caused by: com.vaadin.flow.server.ExecutionFailedException: Error occured during goal execution: Cannot invoke "java.lang.Class.isInterface()" because the return value of "org.reflections.Reflections.forClass(String, java.lang.ClassLoader[])" is null

Please run Maven with the -e switch (or Gradle with the --stacktrace switch), to learn the full stack trace.
	at com.vaadin.flow.plugin.base.BuildFrontendUtil.prepareFrontend(BuildFrontendUtil.java:178)
	at com.vaadin.flow.plugin.maven.PrepareFrontendMojo.execute(PrepareFrontendMojo.java:64)
	... 34 more
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Class.isInterface()" because the return value of "org.reflections.Reflections.forClass(String, java.lang.ClassLoader[])" is null
	at org.reflections.Reflections.lambda$getTypesAnnotatedWith$12(Reflections.java:405)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at org.reflections.util.QueryFunction.lambda$filter$3(QueryFunction.java:32)
	at org.reflections.util.QueryFunction.lambda$add$9(QueryFunction.java:66)
	at org.reflections.util.QueryFunction.lambda$add$9(QueryFunction.java:66)
	at org.reflections.util.QueryFunction.lambda$asClass$13(QueryFunction.java:89)
	at org.reflections.Reflections.get(Reflections.java:365)
	at org.reflections.Reflections.getTypesAnnotatedWith(Reflections.java:403)
	at com.vaadin.flow.server.scanner.ReflectionsClassFinder.getAnnotatedClasses(ReflectionsClassFinder.java:87)
	at com.vaadin.flow.server.frontend.scanner.ClassFinder$CachedClassFinder.lambda$getAnnotatedClasses$0(ClassFinder.java:154)
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)
	at com.vaadin.flow.server.frontend.scanner.ClassFinder$CachedClassFinder.getAnnotatedClasses(ClassFinder.java:153)
	at com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner.verifyTheme(FullDependenciesScanner.java:390)
	at com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner.discoverTheme(FullDependenciesScanner.java:349)
	at com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner.<init>(FullDependenciesScanner.java:141)
	at com.vaadin.flow.server.frontend.scanner.FullDependenciesScanner.<init>(FullDependenciesScanner.java:94)
	at com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner$FrontendDependenciesScannerFactory.createScanner(FrontendDependenciesScanner.java:93)
	at com.vaadin.flow.server.frontend.NodeTasks.<init>(NodeTasks.java:125)
	at com.vaadin.flow.plugin.base.BuildFrontendUtil.prepareFrontend(BuildFrontendUtil.java:172)
	... 35 more

Expected-behavior

The project starts

Reproduction

npm init vaadin@latest
open project in VS Code
run the Application class

System Info

Vaadin 24.4.12

@Artur- Artur- added the bug label Sep 26, 2024
@Artur-
Copy link
Member Author

Artur- commented Sep 26, 2024

This is presumably related to

  1. The project using Java 21
  2. VS Code running the prepare-frontend target automatically because of some existing lifecycle mapping for Eclipse
  3. VS Code not using Java 21 when running that Maven task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant