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

Test sourceset doesn't have minecraft in its classpath #3

Open
filloax opened this issue Oct 12, 2024 · 2 comments
Open

Test sourceset doesn't have minecraft in its classpath #3

filloax opened this issue Oct 12, 2024 · 2 comments

Comments

@filloax
Copy link

filloax commented Oct 12, 2024

Hi, for my small library I tried switching to minivan from vanillagradle, but my test module (needed to avoid headache in a codec-related API I made) doesn't seem to have Minecraft in its classpath after switching. Is this normal?

@filloax
Copy link
Author

filloax commented Oct 12, 2024

A workaround was using the manual version and adding it to testImplementation, like this:

val minecraft = minivan.minecraftBuilder()
    .version(minecraftVersion)
    .accessWideners("src/main/resources/${modid}.accesswidener")
    .build()
    .minecraft;

// Fix minivan not adding minecraft to test classpath
project.dependencies.add("testImplementation", project.files(minecraft.minecraft))
minecraft.dependencies.forEach { project.dependencies.add("testImplementation", it) }

(kotlin DSL)

@quat1024
Copy link
Member

Yeah I just slap the dependency into compileOnly by default:

minecraftBuilder()
.version(version)
.accessWidener(accessWideners)
.build()
.tryGetMinecraft()
.installTo(project, "compileOnly");

Never noticed since I don't really write a lot of tests 😅 I should add it to testCompileOnly or smtn; this should probably be made configurable as well

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

No branches or pull requests

2 participants