I think your question isn't actually about breaking code blocks (i.e., making the lines wrap to fit across the width of the page, or splitting the block over two pages).
From your proposed solution, I think the actual problem is that your code blocks are floating, meaning they don't appear where you've put them in the text, but actually show up later on in the document. This is a consequence of exporting to pdf, which uses LaTeX. LaTeX provides very sophisticated, and occasionally annoying, handling of floats. When you supply a
#+CAPTION to your source code, org mode assumes you want to treat the block as a float.
You can force the block not to float by including
:float nil flag:
*** ~Code file header~
#+CAPTION: ~Code file path~
#+ATTR_LATEX: :float nil
#+BEGIN_SRC scala -n