npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

treat-maven-dependency-plugin-log

v0.4.0

Published

it solves the problem of consuming maven-dependency-plugin tree log information from multiple modules

Downloads

2

Readme

Treat maven-dependency-plugin log information

This script tries to solve the problem of consuming maven-dependency-plugin information from multiple modules from multiple projects.

Let's clarify the problem it tries to cover

What happens whenever you want to upgrade a library but you need to analyze the side effect of this new library version with the rest of the projects in you organization? Imagine you have more than a thousand maven modules involved? How would you do it? Well... treat-maven-dependency-plubin-log proposes a simple and easy way to do it. Just run your mvn dependency:tree command for all of your projects and save the log into a file and then run the tool to filter (by regular expressions filters) the artifacts you want to filter from maven-dependency-plugin:tree output. The maven-dependency-plugin:tree output from every module matching the filter will be summarize in one single place module by module, like

###########################################
jbpm-workitems-rest
###########################################

[INFO] org.jbpm:jbpm-workitems-rest:jar:7.64.0-SNAPSHOT
[INFO] +- org.apache.cxf:cxf-rt-transports-http-jetty:jar:3.3.9:test
[INFO] |  +- org.apache.cxf:cxf-core:jar:3.3.9:test
...
...

###########################################
kie-server-spring-boot-autoconfiguration
###########################################

[INFO] org.kie:kie-server-spring-boot-autoconfiguration:jar:7.64.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot:jar:2.3.4.RELEASE:compile
...

and so on and so on...

Real world example

We wanted to move our droolsjbpm-build-bootstrap org.apache.cxf:3.3.9 dependency to org.apache.cxf:3.4.5, easy right? (See RHPAM-4012). Then we noticed comes with jakarta.validation:jakarta.validation-api:2.0.2 and all the projects depending on it (more than 30) are still using the old javax.validation:validation-api:2.0.1, but... how deep the impact for this change is? we needed to measure it and we came to the conclusion we needed to automatize it somehow. We execute a full downstream build for this specific project just running mvn dependency:tree and we stored the output in one single file but now it's time to consume this huge amount of information, so... we decided to create this tool to do the hard work for us by just running commands like

treat-maven-dependency-plubin-log -l thelogfile.log -f "\] \+- org.apache.cxf:cxf.*:jar:3.3.9" "validation-api" -p treat-maven-dependency-plubin-log -l thelogfile.log -f "\] \+- org.apache.cxf:cxf.*:jar:3.3.9" "validation-api" -e "org.kie.soup:kie-soup-dataset-api" -p etc...

Installation and execution

Just install

npm install -g treat-maven-dependency-plugin-log

and execute

treat-maven-dependency-plugin-log -l <filePath>

being <filePath> and absolute or relative path to the maven log file where the mvn dependency:tree output was stored.

Arguments

  • -l, --log-file-path <filePath>: The maven log file path
  • -o, --output-file <filePath>: The file path to write the output information from the execution
  • -f, --filter <regex...>: The regex list to filter just the modules' dependency:tree matching with the regex. For instance -f validator-api:\d will filter just the modules where the dependency tree matches validator-api:\d regular expression.
  • -e, --exclude <regex...>: The regex list to exclude the modules' dependency:tree matching with the regex. For instance -e validator-api:\d will exclude all the modules where the dependency tree matches validator-api:\d regular expression.
  • --skip-output: Will skip output to be written on any file. This invalidates the -o argument.
  • -p ,--print-module-list: It will print out a summary of module lists matching the requirements from execution.
  • -a ,--artifacts <dependency identifier...>: It will print out specific artifact information like at which level and which modules this artifact appear.

Using the tool as a GitHub action

You can use this tool as a GitHub action in your GitHub workflow. See the following example showing how this can be done

name: Java CI with Maven and treat maven dependency plugin

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 11
      uses: actions/setup-java@v2
      with:
        java-version: '11'
        distribution: 'temurin'
        cache: maven
    - name: Build with Maven
      run: mvn -B package --file pom.xml dependency:tree -l ./my-log.log
    - name: Check log
      uses: Ginxo/treat-maven-dependency-plugin-log
      with:
        log-file-path: './my-log.log'
    - name: Archive artifacts
      uses: actions/upload-artifact@v2
      with:
        name: dependency-log
        path: |
          my-log.log