This message was deleted.
# community-support
s
This message was deleted.
1
c
resources
as in src/main/resources? what does “explicit definition” mean? Please explain the problem you are trying to solve and what appears to not be working.
o
Correct. By explicit definition I attempted to make use of
include
inside the build task. Basically the problem I am having is that files inside of src/main/resources are not being shaded into the JAR upon compilation.
c
what does your shading gradle task configuration look like?
o
Plain shadowjar quite frankly. Never had this issue before, but the last time I used Gradle was version 6.
c
ok. are the resources in the jar itself (before shadowing)?
o
They're not. I tried compiling with the default task as well.
c
ok, so this isn’t related to shadow if they aren’t in the pre-shadow jar (presumably the output from
jar
task). That’s all pre-configured as part of the java plugin - are there any configuration changes to sourcesets, etc?
o
Right. Nothing out of the ordinary from what I can see:
Copy code
plugins {
    scala
    `java-library`
    id("com.github.johnrengelman.shadow") version("7.1.2")
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.scala-lang:scala-library:2.13.7")
}
c
…and when you run
jar
, are the resources where expected?
o
No. 😛
The resources are absent no matter what I try. 🤔
c
odd. resources are in src/main/resources?
o
Yep.
c
perhaps try running
jar
with
--clean --no-build-cache
oops.
clean
is the task, not an argument.
./gradlew clean jar --no-build-cache
o
Yeah, no difference.
c
is there scala source to compile in src/main/scala (and/or java source in src/main/java)?
o
Yes, there's scala source code.
c
ok. run with
--info
- look at the
processResources
task (and other tasks) to see if they run.
o
oh uh
Output property 'destinationDir' file C:\Users\Oliwer\Desktop\dev\jvm\scala-loader\lib\build\resources\main has been removed.
c
that would be expected if using
clean
o
That makes sense. 😆
I mean
processResources
does indeed run as expected, it also exports all resource files into build/resources/main.
c
does
jar
run as expected and create a .jar file? iirc in
build/libs
.
o
Yes. The JAR that is exported just does not consist of the resource(s).
c
so we have resources from
processResources
but not from
jar
(and of course missing downstream for shading)?
o
Yes,
processResources
does export the files into the directory of build/resources/main but they're not included in the jar itself when
jar
is ran, if that makes sense. 🤔
c
odd. any special configuration for
jar
beyond the defaults?
o
No. The build file I sent above is all I've got, really.
c
what are examples of some of the resources?
filenames?
o
config.yml
for example.
c
hmmm. was wondering if they overlapped with some of the magical default excludes, but yml doesn’t.
o
It's a really odd situation tbh; I haven't been tied up with this using Gradle before, but that was with version 6.2 and I'm not sure if that has anything to do with it.
c
unlikely. jar stuff is pretty straightforward.
o
hmmm
This is still an issue for those who wonder. ^
n
Is this a project you can share? If not, can you create a minimal reproducer? Or in a pinch, is there some (sanitized/anonomyzed) debug log you can share? There's not a lot of information to go by, right now.
☝️ 1
o
Excuse the late response, Niels. I actually got it working somehow by downgrading to *6.2*; now there does not seem to be a single issue what so ever.
n
that will probably just make the problem worse in the future though, as the gap will just become bigger 🤔 so it's probably a good idea to keep digging
👍 1
o
That's true. I can back up the project and go back to version 7 to do some more digging.
👌 1
Okay so hilariously enough, I found out the issue and it had nothing to do with Gradle what so ever... Initially (using v7), I attempted to decompile the JAR to see if the resource(s) were a part of the contents bundled - in this case they were not cause it filtered out anything but java files (ofc). When I switched over to v6, I attempted - at the same time - to view it over a ZIP archive without thinking much of it and to my surprise it was there. Sorry for the trouble people, I was just a victim of my own stupidness.
😂 1