A shader is a single compilation unit, which must have all referenced variables (in, out, uniforms), types and functions, at least declared, in source-code-form so that the compiler knows what code it needs to generate to read/access them.
So, everywhere you want to access a uniform, it must be declared in that source file as a uniform.
Your options are:
a) use the glShaderSource() overload of LWJGL that accepts multiple source strings: glShaderSource(int shader, CharSequence... strings). This way you can let OpenGL append your common shader source and the using shader source. You would declare the shader #version directive in the common shader source
b) use a custom source (pre-)processor to manually include the common shader source file into each using shader source file
I would really look into option a).