Hidden files not included in JAR Follow
I'm working on a plugin where I have a bunch of resources, some of which are "hidden" files (files whose names start with a dot). I kept getting nulls when trying to access those hidden resources, so I extracted the plugin's JAR from the sandbox to take a look inside, and it turns out all hidden files are missing.
Is this a bug or this behavior expected? In that case is there some project configuration I need to modify to include hidden resource files in the output JAR?
Please sign in to leave a comment.
Please check that "Resource patterns" in Preferences | Build, Execution, Deployment | Compiler matches those dot-files.
Yes the resource patterns are the default ones:
These do include the hidden-file pattern, but just to be sure I tried adding this pattern but it doesn't work either:
Actually it works for me with ".test" file and Build->Prepare Plugin Module for Deployment. Did you try Build->Rebuild Project and/or cleaning sandbox? Also please check "Ignored files" patterns in Preferences | Editor | File Types settings.
Ok I tried adding hidden resource files with different names and now it works! It turns out my hidden files were not being included partly because they were all ".gitignore" files, initially I thought it wasn't relevant but apparently it is.
So I'm guessing it's some part of the git integration somewhere that's (probably indirectly) causing all .gitignore files under the resource directory to be excluded from the generated JAR. Any ideas how to fix this?
The default pattern for "ignored files" settings I mentioned indeed contains ".gitignore", so that explains the behavior.
You could build the JAR with some external build tool instead or remove ".gitignore" from the ignored files pattern.
But the value of the ignored files pattern for me is:
Unless I'm missing something here, this pattern does not include ".gitignore"...
It works for me using the ignore pattern you have configured. Did you try Build->Rebuild Project? What version of IntelliJ IDEA are you using?
Yes I tried Build -> Rebuild Project and it didn't work. I even tried to delete the whole sandbox but it didn't work either :(
I'm running IntelliJ IDEA community 2018.3:
IntelliJ IDEA 2018.3.2 (Community Edition)
Build #IC-183.4886.37, built on December 17, 2018
JRE: 1.8.0_152-release-1343-b26 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-43-generic
Could you try disabling all 3rd party plugins? Maybe one filters ".gitignore" files programmatically.
Ok I tried disabling all downloaded plugins (including jetbrains ones) and kept only bundled jetbrains plugins enabled. Still not working!
Is it possible to share your project? eventually link/upload to https://youtrack.jetbrains.com/issues/IDEA with visibility "idea-developers" group to make it private. Thanks!
Yes the project is public anyways, you can try to install the plugin and inspect the JAR yourself:
https://github.com/AdaCore/Ada-IntelliJ
An example of the ".gitignore" files that are not included in the output JAR:
https://github.com/AdaCore/Ada-IntelliJ/blob/master/src/main/resources/project-templates/ada_library_project/obj/.gitignore
So should I open an issue on youtrack for this?
Sorry for delay. I was assuming you were using IDE's "Prepare Plugin for Deployment" where the settings I proposed would actually take effect.
But indeed it is an issue with Gradle https://stackoverflow.com/questions/29504250/how-to-copy-hidden-resource-files-in-gradle
Hope this helps now.
Right, another detail I should have mentioned from the beginning... Thanks for the help!
For anyone having a similar problem, see these issues:
https://github.com/gradle/gradle/issues/1348
https://github.com/gradle/gradle/issues/2986