Is there any guideline about storing binary files in a maven project? I'm working on a project that involves machine learning. The project is OSS and we are going to publish it in Sonatype OSS repository. The project includes several pre-trained models that comprises both textual and binary files. We would like to ship these models along with the library itself. Is it fine to simply put models files into src/main/resources
directory of the project?
Asked
Active
Viewed 235 times
1

Alexander Solovets
- 2,447
- 15
- 22
1 Answers
2
Is it fine to simply put models files into src/main/resources directory of the project?
Yes. However, if these are very large files (considerably larger than the code itself), you may wish to keep them in a separate module (trained-model-data
, or similar) to isolate it from the code.
If this data changes infrequently, you may also want to version and release it separately from your code, so a new release of your main project wouldn't require a new release of the trained data. That would mean that a bugfix release could just update the code.

Joe
- 29,416
- 12
- 68
- 88
-
Do you know any project that has such binary data packages? – Alexander Solovets Mar 02 '14 at 05:56
-
Not within a single project. Wherever I've seen this for uploading packaged distributions, or native binaries (e.g. [It's possible to put binary files on nexus repository?](http://stackoverflow.com/questions/3662465/its-possible-to-put-binary-files-on-nexus-repository)) it's been a one-off upload that's then been used by the main project. Unless your training files are huge, go ahead and include them in the main `.jar`. – Joe Mar 02 '14 at 08:50