Skip to content

lizzyTheLizard/java-dependency-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dependency-Analyzer

GitHub Workflow Status GitHub top language GitHub commit activity (branch) GitHub issues GitHub pull requests GitHub GitHub release (latest by date) Maven Central

A class level dependency analyzer for JVM programs. It can be integrated as a maven plugin or run via command line, and it will generate an interactive HTML documentation of the class dependencies.

Example dependency analysis for this plugin

Usage (Command Line)

The dependency-analyzer can be used via command line to analyze class or jar files directly. It can be started using

java -jar dependency-analyzer-0.4.1-SNAPSHOT-jar-with-dependencies.jar [arguments] inputs

Configuration

The following configuration options can be used.

Parameter Description Example Default
--debug / -d Turn on debug mode (Boolean) true false
--outputFolder / -o Output folder name (String) /home/user/test.jar "Working Dir"
--includeFatJarClasses When input is a SpringBoot FatJar, include the SpringBoot-Loader-Classes as well (Boolean) true false
--fatJarMatchers When input is a SpringBoot FatJar, include all dependencies that matches on of those regexes (List of Strings) maven-dependency-analyzer-.* ""

Usage (Maven-Plugin)

The dependency-analyzer offers a goal "create-documentation" that will analyze the generated output in the phase `` process-classes```. It can be integrated into the build process using

<build>
    <plugins>
        <plugin>
            <groupId>site.gutschi</groupId>
            <artifactId>dependency-analyzer</artifactId>
            <version>0.4.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>create-documentation</goal>
                    </goals>
                    <configuration>
                        <!-- see below for config options-->
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

This will generate a documentation under target/doc

Configuration

The following configuration options can be used.

Parameter Description Example Default
inputs Input files to be considered. A list of folders or files, all ".class" and ".jar" files in this and all its sub-folders will be analyzed target/classes,target/project.jar ${project.build.outputDirectory}
dependencyMatchers Matched dependency will be analyzed as well. A list of regexes matching the string "groupId:artifactId:versionId" of the dependency. If none given, no dependencies will be analyzed org.apache.maven.shared:maven-dependency-analyzer:.* -
outputFolder The output-folder to write the documentation to target/dependency ${project.build.directory}/doc
basePackage A preselected base-package within the generate documentation. If given, the documentation will zoom directly on this package com.you.application -
collapsePackages A list of packages who will be collapsed in the generated documentation. The plugin will try to automatically collapse external libraries, but you can overwrite this setting here. org.springframework,com.google -
ignoredPackages A list of packages who will be ignored in the generated documentation. The plugin will try to automatically ignore JDK-classes, but you can overwrite this setting here. java,kotlin,sun -
splitPackages A list of packages who will be split in the generated documentation. The plugin will try to automatically split certain widely used prefixes (e.g "org"), but you can overwrite this setting here. org,org.apache,com -

List can either be given as comma-seperated lists or using multiple arguments

<configuration>
    <inputs>
        <input>target/classes</input>
        <input>../otherLib/target/classes</input>
    </inputs>
</configuration>
<configuration>
    <inputs>target/classes, ../otherLib/target/classes</inputs>
</configuration>

Build

In order to build this plugin from scratch, you have to install

  • Node.js, Version >= 18.0.0
  • Yarn, Version >= 3.5.0
  • A JDK Version >= 11

You must then build the frontend first using

cd frontend
yarn install
yarn build

and then build the backend using the maven wrapper

cd dependency-analyzer
./mvnw install

Build With

The Frontend is build using Typescript, lit, Yarn and WebComponents from the Carbon Design System

The Backend is build using Kotlin and Maven. The dependency analyses is performed using ASM and some visitors from the maven-dependency-plugin.

Bugs

If you find any bugs or have potential improvements, please open an issue in the GitHub-Project

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published