requirements: add JavaDependency.

Requested in Homebrew/homebrew-science#1039.
Closes #30852.
dependency_collector: add :java symbol
mesos: use JavaDependency.
tomcat-native: use JavaDependency.
pylucene: use JavaDependency.

Closes #31008.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>