-
-
Notifications
You must be signed in to change notification settings - Fork 566
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
Trial with Gradle BadAss plugin #2132
Comments
Hey @swar-mukh, thank you for reporting this, We'll look into it. We currently have no way of testing Javalin JPMS capabilities, so I'll have to dig to see what's going on. Could you provide the logs for both of the cases? Only runtime ones, the build ones shouldn't be relevant.
I understand this might be a problem, I'll look into the binaries if you can't provide the logs. Either way, using the BadAss runtime plugin instead of the JPMS one might just solve it, this problem could be on Jetty's side. |
nah that has nothing to do with it. |
Any luck @swar-mukh ? |
jpackage is its own thing that uses jlink, the problem here is with application java runtime images (JRT) that jlink produces. I made a repo showcasing the problem using a maven plugin as well as raw jlink: https://github.com/SentryMan/javalin-jlink-issue It appears Jetty is using |
Hi @zugazagoitia, sorry couldn't respond earlier. Was caught up with office work. I experimented in various ways (limited by Javalin API obviously) with the underlying However, here are few things I want to mention:
Now, while the above two points definitely are not resolutions and it is imperative that in someway this has to be resolved, either here or through raising another issue with Jetty (it's your call folks) or through some other repo (which I may not be aware of), I think it is very important in the time-being, that this be documented somewhere in the public website so that people don't have to scour the internet looking for a resolution. I think, we can/may contact the author of #1624 who subsequently had also created a detailed post for some advice or for a contribution in his post so that the quirks of JPMS (especially w.r.t. Javalin) is known to the public. |
well to be precise, they are present, but the standard way of accessing resources by directory doesn't work.
wait are you even still running on the module-path with this method? Anyway, helidon seems to work around this by not loading the directory. They keep the directory path and append requested resources to that. So like routing
.register("/", StaticContentService.builder("/web-ui")
.build(); then we can call |
What I meant was, yes, they are present in the build, except it's not inside the image. And yes, we both agree on the standard way of accessing not working properly. I haven't tested with
Like I mentioned, I have experimented it with module-path as well as with the old classpath (forgot the commands now, I'm not on my system), the issue persists. Just pure trial-n-error mode.
I am aware of Helidon (and equally with Nima), which apart from inspiration in |
Yeah, I'm thinking along the lines of reverse-engineering their resource strategy for javalin |
My original suggestion still stays, which is while the authors/contributors come up with a resolution: in the interest of developers (especially beginners), somewhere in the public website, it should be documented. Once this GitHub issue is resolved, the documentation can be reverted (sans few quirks, of course). I am not aware of Javalin usage analytics, but suffice to say, it's a beautifully crafted framework, which perhaps necessitates time-boxing this issue (just an opinion). Feel free to dismiss it if you like. |
We don't provide "first class" support for JPMS, since none of the maintainers use it, and we have no easy way to test it either. Lucky for you I'm reimplementing Javalin resource handling right now decoupled from Jetty, so I can consider this. If you can point me to the correct API to use for loading Classpath resources I will gladly implement it. |
It's more changing the approach to not load files via directory. If you want to load everything inside a directory you'll need a specific file within that directory, then from there you can go wild. List<Path> getPathsInDirectory(String directoryName, final String initialFile)
throws URISyntaxException, IOException {
var path = getClass().getResource(initialFile).toURI();
// get directory and iterate (will go through nested directories as well)
return Files.walk(Paths.get(path).getParent())
.skip(1)
.filter(
p -> {
var pathStr = p.toString().replace("\\", "/");
pathStr = pathStr.substring(pathStr.indexOf(directoryName));
return getClass().getResource(pathStr) != null;
})
.toList();
} |
Hi all, you folks are doing a fantastic job! I see the maintainers busy with a lot of work and addressing incoming issues. Thanks for all that you do for the community! Was passing by, any updates/progress on this issue? Nothing else. Regards! |
Hello,
Given that focus on JPMS is currently ongoing, I am following up on an issue (#1624) that was earlier raised, and its subsequent solution and commentary, as well as a detailed guide on the Community post.
I was researching into a solution to find if there exists any
jlink
wrapper solutions in the market that can handle "automatic resolutions", and found that a Gradle plugin, awkwardly titled, BadAss (link here), handles the resolutions by itself.However, when I took it for a spin with Javalin, suprisingly
kotlin-stdlib
, ororg.jetbrains.*
wasn't the issue, but the following:org.slf4j
is not resolved in the final custom JRE imageweb-ui
directory underresources
cannot be effectively resolved in the final image when usingconfig.staticFiles.add("web-ui", Location.CLASSPATH);
(but it works if you normally run the application)Now, where the issue lies is a bit cloudy. It could be Javalin's or the plugin's issue, or it could even be my setup issue. As a tinkerer and an enthusiast, all I want is for open-source tools to play well with each other and be in harmony. I don't want to miss this opportunity to have a custom JRE image with Javalin embedded in it.
I was wondering if you could provide some insights/assistance into the above, so that once a solution or bug is found, I can (if necessary), raise them in the respective GitHub repos. I am attaching a
gradle
project which you can run in your local machine.To reproduce the issues:
gradle clean run
:a.
web-ui/
path is found, and app runsb. All logging happens as usual
gradle clean build jlink
:a.
web-ui/
path is not found, and app runs w/o the static files endpointsb. Logging doesn't happen as the dependency is not found
Some other handy references here: #1908, #1947
Attachment: java-webapp.zip
The text was updated successfully, but these errors were encountered: