ZOOKEEPER-3943: Zookeeper Inspector throwing NullPointerExceptions and not displaying properly

ISSUE
---
See https://issues.apache.org/jira/browse/ZOOKEEPER-3943 for details on the issue.

There are two main things being addressed in this PR:

1. The Maven build for ZooInspector seems to generate an invalid JAR file that is missing graphical resources that cause the application to be non-functional (UI does not render properly, NullPointerExceptions occur constantly, etc.).

2. The current Maven build instructions and run scripts for ZooInspector involve building, moving JAR files around, using relative entries on the CLASSPATH and running the scripts from the correct directory in order to use the `zooInspector.sh`/`zooInspector.cmd` launch scripts.

FIXES
---
For number 1, the fix is to add the `src/main/resources/*` directories to the JAR artifact built by Maven.

For number 2, I've proposed changing the Maven build to use the [Maven Assembly Plugin](http://maven.apache.org/plugins/maven-assembly-plugin/) to build a single "fat jar" for ZooInspector that contains all of its dependencies.  The result is that building and running the tool is easier and more straightforward (in my opinion):

```
git clone https://github.com/apache/zookeeper.git
cd zookeeper
mvn install -DskipTests
cd zookeeper-contrib/zookeeper-contrib-zooinspector
mvn install
./zooInspector.sh
```

And based on the "fat jar" style of build and updates to the run scripts, the `zooInspector.sh` and `zooInspector.cmd` commands now successfully execute from any directory (once the project is built) as opposed to requiring you to be in the same directory as the scripts.

My hope is that these changes allow people like myself who are mainly interested in using ZooInspector to easily clone the repository, build and run the tool without any issues.  I spent a chunk of time getting this all working for myself and I hope I can save others some trouble.

TESTING
---
I've tested cloning, building and running ZooInspector on Windows 10, Mac OS X Mojave (10.14.6) and Ubuntu Linux 18.04 using the steps above (on Java 8).

I ran `mvn verify spotbugs:check checkstyle:check -Pfull-build -Dsurefire-forkcount=4` in the root directory (per https://cwiki.apache.org/confluence/display/ZOOKEEPER/HowToContribute#HowToContribute-FinalChecksonPullRequest) and got these results:

```
[INFO]
[ERROR] Tests run: 2881, Failures: 4, Errors: 4, Skipped: 4
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Apache ZooKeeper 3.7.0-SNAPSHOT:
[INFO]
[INFO] Apache ZooKeeper ................................... SUCCESS [  7.731 s]
[INFO] Apache ZooKeeper - Documentation ................... SUCCESS [  3.223 s]
[INFO] Apache ZooKeeper - Jute ............................ SUCCESS [ 32.705 s]
[INFO] Apache ZooKeeper - Server .......................... FAILURE [30:28 min]
[INFO] Apache ZooKeeper - Metrics Providers ............... SKIPPED
[INFO] Apache ZooKeeper - Prometheus.io Metrics Provider .. SKIPPED
[INFO] Apache ZooKeeper - Client .......................... SKIPPED
[INFO] Apache ZooKeeper - Client - C ...................... SKIPPED
[INFO] Apache ZooKeeper - Recipes ......................... SKIPPED
[INFO] Apache ZooKeeper - Recipes - Election .............. SKIPPED
[INFO] Apache ZooKeeper - Recipes - Lock .................. SKIPPED
[INFO] Apache ZooKeeper - Recipes - Queue ................. SKIPPED
[INFO] Apache ZooKeeper - Assembly ........................ SKIPPED
[INFO] Apache ZooKeeper - Compatibility Tests ............. SKIPPED
[INFO] Apache ZooKeeper - Compatibility Tests - Curator ... SKIPPED
[INFO] Apache ZooKeeper - Tests ........................... SKIPPED
[INFO] Apache ZooKeeper - Contrib ......................... SKIPPED
[INFO] Apache ZooKeeper - Contrib - Fatjar ................ SKIPPED
[INFO] Apache ZooKeeper - Contrib - Loggraph .............. SKIPPED
[INFO] Apache ZooKeeper - Contrib - Rest .................. SKIPPED
[INFO] Apache ZooKeeper - Contrib - ZooInspector .......... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  31:12 min
[INFO] Finished at: 2020-12-05T01:08:27Z
[INFO] ------------------------------------------------------------------------
```
Since all of my proposed changes are in the `zookeeper-contrib` subtree, I'm assuming this doesn't have anything to do with my changes.  Running the same command in the `zookeeper-contrib` directory seems to pass for those tests:

```
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Apache ZooKeeper - Contrib 3.7.0-SNAPSHOT:
[INFO]
[INFO] Apache ZooKeeper - Contrib ......................... SUCCESS [  8.590 s]
[INFO] Apache ZooKeeper - Contrib - Fatjar ................ SUCCESS [ 13.636 s]
[INFO] Apache ZooKeeper - Contrib - Loggraph .............. SUCCESS [ 20.515 s]
[INFO] Apache ZooKeeper - Contrib - Rest .................. SUCCESS [ 13.394 s]
[INFO] Apache ZooKeeper - Contrib - ZooInspector .......... SUCCESS [ 17.056 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:14 min
[INFO] Finished at: 2020-12-05T01:13:22Z
[INFO] ------------------------------------------------------------------------
```

Author: brentwritescode <brentwritescode@gmail.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>, Damien Diederen <ddiederen@apache.org>

Closes #1551 from brentwritescode/master
4 files changed
tree: da50c5c9d7789368a3cd504a33b36fe6afcc1c78
  1. .github/
  2. bin/
  3. conf/
  4. dev/
  5. tools/
  6. zookeeper-assembly/
  7. zookeeper-client/
  8. zookeeper-compatibility-tests/
  9. zookeeper-contrib/
  10. zookeeper-docs/
  11. zookeeper-it/
  12. zookeeper-jute/
  13. zookeeper-metrics-providers/
  14. zookeeper-recipes/
  15. zookeeper-server/
  16. .asf.yaml
  17. .gitattributes
  18. .gitignore
  19. .travis.yml
  20. checkstyle-simple.xml
  21. checkstyle-strict.xml
  22. checkstyleSuppressions.xml
  23. excludeFindBugsFilter.xml
  24. Jenkinsfile
  25. Jenkinsfile-owasp
  26. Jenkinsfile-PreCommit
  27. LICENSE.txt
  28. NOTICE.txt
  29. owaspSuppressions.xml
  30. pom.xml
  31. README.md
  32. README_packaging.md
  33. zk-merge-pr.py
README.md

Apache ZooKeeper GitHub Actions CI Travis CI Maven Central License

alt text

For the latest information about Apache ZooKeeper, please visit our website at:

https://zookeeper.apache.org

and our wiki, at:

https://cwiki.apache.org/confluence/display/ZOOKEEPER

Packaging/release artifacts

Either downloaded from https://zookeeper.apache.org/releases.html or found in zookeeper-assembly/target directory after building the project with maven.

apache-zookeeper-[version].tar.gz

    Contains all the source files which can be built by running:
    mvn clean install

    To generate an aggregated apidocs for zookeeper-server and zookeeper-jute:
    mvn javadoc:aggregate
    (generated files will be at target/site/apidocs)

apache-zookeeper-[version]-bin.tar.gz

    Contains all the jar files required to run ZooKeeper
    Full documentation can also be found in the docs folder

As of version 3.5.5, the parent, zookeeper and zookeeper-jute artifacts are deployed to the central repository after the release is voted on and approved by the Apache ZooKeeper PMC:

https://repo1.maven.org/maven2/org/apache/zookeeper/zookeeper

Java 8

If you are going to compile with Java 1.8, you should use a recent release at u211 or above.

Contributing

We always welcome new contributors to the project! See How to Contribute for details on how to submit patch through pull request and our contribution workflow.