简体   繁体   中英

Mp3 resource encoded as text in Intellij IDEA

everyone.

  • I have mp3 file in Intellij IDEA project under resources dir - ' src\main\resources\com\company\app\sound\type.mp3 '

  • When I rebuild project, the file appears in target - 'classes\com\company\app\sound\type.mp3'

  • But it has different size and wrong binary data.

I've found out that IDEA is to blame.

  • it copies mp3 resource as text
  • and unexpectedly encodes it from ASCII (why??) to UTF-8 (default charset in project)
  • Maven build does the same.

I've tried

  • setting encoding for the mp3 file ASCII (though it's nonsence) - gives target file of correct size, but not playable
  • adding *.mp3 to Compiler -> Resource patterns - no effect

I'm looking for

  • an IDEA setting that will recognize mp3 file as binary, not text.
  • or a better way to store binarry resources (though my images are ok)

Any help?

The bug was in my pom.xml Resource filtering was set to true

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