Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Refine support for custom application class #1226

Closed
hdeadman opened this issue Nov 7, 2021 · 1 comment
Closed

Refine support for custom application class #1226

hdeadman opened this issue Nov 7, 2021 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@hdeadman
Copy link
Contributor

hdeadman commented Nov 7, 2021

I am working on trying to build an application where the class containing @SpringBootApplication comes from a dependency. It would be nice if we could optionally specify the name of the main class as an alternative to it being searched for. The current error I am running into is a NullPointerException when QuartzHints is processing, due to it not being able to determine the package of the main class.

./gradlew build

> Task :generateAot
2021-11-06 21:41:04.631  WARN 2560 --- [           main] o.s.a.build.ContextBootstrapContributor  : No application class detected, skipping context bootstrap generation
2021-11-06 21:41:05.905  INFO 2560 --- [           main] o.s.nativex.support.SpringAnalyzer       : Spring Native operating mode: native

> Task :compileAotMainJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/hdeadman/git/cas-overlay-template/build/generated/sources/aotMain/org/springframework/aot/StaticSpringFactories.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :generateTestAot
WARNING: Unable to find jar '/home/hdeadman/git/cas-overlay-template/build/classes/java/test' whilst scanning filesystem
WARNING: Unable to find jar '/home/hdeadman/git/cas-overlay-template/build/resources/test' whilst scanning filesystem
2021-11-06 21:41:36.485  INFO 2611 --- [           main] o.s.nativex.support.SpringAnalyzer       : Spring Native operating mode: native
java.lang.NullPointerException
        at java.base/java.lang.String.contains(String.java:2036)
        at org.springframework.nativex.type.TypeSystem.findDirectoriesOrTargetDirJar(TypeSystem.java:1355)
        at org.springframework.nativex.type.TypeSystem.scan(TypeSystem.java:1512)
        at org.springframework.nativex.type.Type.getSubtypes(Type.java:3081)
        at org.springframework.scheduling.quartz.QuartzHints.computeHints(QuartzHints.java:115)
        at org.springframework.nativex.type.SpringConfiguration.<init>(SpringConfiguration.java:58)
        at org.springframework.nativex.type.TypeSystem.ensureSpringConfigurationDiscovered(TypeSystem.java:914)
        at org.springframework.nativex.type.TypeSystem.getAccessCheckers(TypeSystem.java:1305)
        at org.springframework.nativex.support.ReflectionHandler.addAccess(ReflectionHandler.java:142)
        at org.springframework.nativex.support.ReflectionHandler.addAccess(ReflectionHandler.java:91)
        at org.springframework.nativex.support.ReflectionHandler.registerWebApplicationTypeClasses(ReflectionHandler.java:65)
        at org.springframework.nativex.support.ReflectionHandler.register(ReflectionHandler.java:71)
        at org.springframework.nativex.support.SpringAnalyzer.analyze(SpringAnalyzer.java:86)
        at org.springframework.aot.nativex.ConfigurationContributor.contribute(ConfigurationContributor.java:71)
        at org.springframework.aot.build.BootstrapCodeGenerator.generate(BootstrapCodeGenerator.java:90)
        at org.springframework.aot.build.BootstrapCodeGenerator.generate(BootstrapCodeGenerator.java:68)
        at org.springframework.aot.test.build.GenerateTestBootstrapCommand.call(GenerateTestBootstrapCommand.java:87)
        at org.springframework.aot.test.build.GenerateTestBootstrapCommand.call(GenerateTestBootstrapCommand.java:45)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at org.springframework.aot.test.build.GenerateTestBootstrapCommand.main(GenerateTestBootstrapCommand.java:92)

> Task :generateTestAot FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateTestAot'.
> Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
...
BUILD FAILED in 39s

Project and Branch:
https://github.com/apereo/cas-overlay-template.git
origin/graal-starter

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 7, 2021
@hdeadman
Copy link
Contributor Author

I made this PR to get past this issue: #1259

@sdeleuze sdeleuze added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 16, 2021
@sdeleuze sdeleuze self-assigned this Nov 16, 2021
@sdeleuze sdeleuze added this to the 0.11.0-RC1 milestone Nov 16, 2021
@sdeleuze sdeleuze changed the title Handle main class in dependency jar rather than in project Refine support for custom application class Nov 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A general bug
Development

No branches or pull requests

3 participants