Help with include pattern on jar task

Im trying to include some jars that are in my libs folder (src/main/resources/libs), but when I add the include on the jar task the final compiled jar came out empty

shadowjar {
  include '/libs/*.jar'. (If I add this my final jar came out empty, just the META-INF folder is created)
  exclude '/confFiles' (this is fine, exclude files that are not needed for the final version)
...
...

}

I don’t understand what the includes does, and even so, the jars are not copied to the intended jar, what Im doing wrong?

The include and exclude are filters on the content that is to be included in the JAR (from the source files that are already configured).

By default, the include is everything. Adding an include means that only file that match /libs/*.jar in the JAR would be included. That would usually be nothing, so the JAR is empty.

It does not add additional files to the source files. Use from to add to the source.

However, the you would normally not do this manually. The ShadowJAR would usually handle this for you with you adding those libs to your dependencies, either that are used in compilation or just at runtime.

1 Like