packagemap-java-parser provides a parser to build maps of your java code.
Check out the site at https://packagemap.co
Code review just got a lot easier! Visualise your code.
Use the github action:
- name: PackageMap java parser Github action
uses: packagemap/packagemap-java-parser@v0.0.4
with:
src_dir: 'src/main/java'
base: 'com.mycompany'
api_key: ${{ secrets.PACKAGEMAP_KEY }}- Add the github action config
- Add a PACKAGEMAP_KEY secret to your repo in the format
user_id:secret_key
- Sign up at packagemap.co to get an API Access key, and API Secret key.
- Download the jar from the release page and run it
java -jar packagemap-java-parser-0.0.4-all.jar \
--key <access-key>:<secret-key> \
--base com.mycompany \
[list of java source directories separated by spaces]You can also pass the api key using --key flag or using the PACKAGEMAP_KEY environment variable.
For example:
java -jar packagemap-java-parser-0.0.4-all.jar \
--key ABCDEFGHIJKLMNOP:183b9d197ed48a67c6e479a51 \
--base com.mycompany \
./src/main/java- The parser will print out the URL of the map, navigate to that URL to analyse and filter.
- Try out the
--git=flag with a branch name--git=origin/mainor a commit hash to map only the files that have changed.
Instead of running the jar directly, you can use the docker image packagemap/packagemap-java-parser:
docker run \
-v $(pwd):/project \
packagemap/packagemap-java-parser
--key <access-key>:<secret-key> \
--base com.mycompany \
/project/src/main/java| flag | description |
|---|---|
| -b, --base | The base package that all our source code shares. This helps the parser ignore classes imported from your dependencies |
| -k, --key | Your access key and secret key. Maps will be added to your account on packagemap.co. Alternatively you can pass the PACKAGEMAP_KEY environment variable. Both flag and env var use the colon separated format user_id:secret_key |
| -g, --git | Builds a map of only the files that have changed vs. the target commit hash or head of the target branch. |
| [dirs] | A list of directories to parse the source files from. The directory should target just above the source code package hierarchy. e.g. for class src/main/java/co/packagemap/Main.java we should use the directory src/main/java. |
The UI renders the graphs of the source code. It allows filtering and excluding classes.
- Filter by wildcard with
*. e.g.*MyClassto match all types ending inMyClass. - Filter by package prefix. e.g.
com.mypackage.datato match all types in thedatapackage.
