This question's theme seems to be specifically the "missingness" of a given package... so, to anyone that may need an answer to THIS... but not in the context of an external library being imported...
Java's convention specifies that a group(package) can NEVER be composed of a SINGLE subgroup... this means:
/my_package | |-sub_group_a | |-HangingClass.java
This means that if sub_group_a is created... HangingClass.java will ALSO need its own category. IF this is not done... dependencies of HangingClass.java that are within sub_group_a will NOT BE SEEN... EVEN IF the syntax is structured as a dereference.... since when a dereference structure is used('.' operand)...Intellij WILL NOT mark it as visibility mistake.
example:
HangingClass { public void aFunction(String s) { String res = AClassWithinSubGroupA.ASubClass.someStaticMethod(s); return res; } }
Now... this may happen accidentally when refactoring your project... and if you commit and publish... the error will not be seen, and the error may appear when trying to use the code on the other importer end
The solution is for BOTH classes to be AT LEAST AT THE SAME DEPTH in the directory tree.
/my_package | |-sub_group_a | | | AClassWithinSubgroupA.java | |-sub_group_b | HangingClass.java
Now Java will correctly compile.
If you think about it very carefully it makes sense (from a philosophical perspective) that ANY subgroup defined within a containing group... SHOULD define an alternate version of it.
Think about the reddit meme "X implies the existence of Y":
“Dr. Pepper implies the existence of a shadowy, enigmatic figure called simply ‘Dr. Salt.’”
So, for any categorization, the entire group is forked into 2 categories:
- The category you created
- The things you don't consider within the created category: "A shadowy, enigmatic package".
Compile. If set to a scope ofProvidedit will cause the behavior you describe.