How to get built jar during test-time (JUnit)

I'm making an integration testing framework for Minecraft plugins which uses JUnit. My plan is to send a built plugin file during test-time to a docker container, which in term runs a server with that specific plugin file, which will be loaded using the servers class loader. This file should not include test resources The problem I'm facing is that there's large differences in buildscripts for projects; it would not be feasible to just run something like ./gradlew build and retrieve the file from it's directory, as there's also maven, and multimodule projects and much more that I don't know about. What is the least painful approach to generate or fetch this file?
8 Replies
JavaBot
JavaBot6d ago
This post has been reserved for your question.
Hey @Thorinwasher! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st6d ago
Does your framework need to run the build? Can't you just let the dev specify where the JARs are located?
dan1st
dan1st6d ago
also https://testcontainers.com/ might be useful
Testcontainers
Testcontainers
Testcontainers is an opensource library for providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
Thorinwasher
ThorinwasherOP6d ago
Yes, that's one way of doing it, I would rather have a copy paste solution for this though, as it makes the project easier to use The more I think about it, the more I think a Gradle plugin that moves the compiled JAR to a predefined location is a better idea.
dan1st
dan1st6d ago
You don't know how people like to build their stuff you could allow them to configure the command thatÄs executed
Thorinwasher
ThorinwasherOP6d ago
Alright, I guess that's the only real way to offer compatibility with all build systems. I think I will still try to make a gradle plugin for this. It would make life easier for at least gradle devs Thanks for answering by the way!
JavaBot
JavaBot6d ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
JavaBot
JavaBot6d ago
Post Closed
This post has been closed by <@270177852157067264>.

Did you find this page helpful?