简体   繁体   中英

How to add an external file to the jar using gradle?

Until recently I was just using a simple Java project. I recently decided to upgrade it to use a gradle wrapper and Netbeans 12, but now the program is unable to detect the beep3.wav file .

Earlier, I had managed to get the project to automatically embed the wav file into the jar. But now the project properties do not have any such option, which I assume is because the embedding has to be done via gradle. Even though the file is visible as part of the project, I couldn't see it in the jar when I opened the jar using archive manager.
在此处输入图像描述

I've seen this , this and many other pages, but none of them have info on adding files to the jar, so I'm assuming I'm looking for the wrong info.

Could you help with this please? I just need to get that wav file to automatically get inserted into the jar when I build the project.

You just add your files to src/main/resources and they end up in your jar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM