Skip to content

modernizing/merry

Repository files navigation

Going Merry

a legacy Java system build migration toolbox, support ant to maven, find lost dep in nexus...

Go Build Status codecov GitHub go.mod Go version Maintainability

Refactor Tool -> Coca

Online Example for Call Analysis: https://modernizing.github.io/merry/demo

Online Screenshots:

Merry

Feature lists:

Available Commands:
  boom        generate pom.xml from build.xml
  call        show call graph for packages
  checksum    checksum file md5
  dupsearch   build maven pom from all jars file
  fix         fix jar naming issue
  help        Help about any command
  manifest    manifest query & map tools
  map         generate map.csv from jar
  pom         generate pom file from jar file
  version     version

Usage

  1. install
go get -u github.com/phodal/merry
  1. generate pom.xml from build.xml
merry boom
  1. search package lost in nexus
merry dupsearch
  1. map file example

format: {origin},{GroupId},{ArtifactId},{VersionId}

origin,groupid,artifactId,version
org.springframework.transaction,org.springframework,transaction.org.springframework.transaction,2.5.6.SEC01
javax.servlet,javax.servlet,javax.servlet,2.4.0
edu.emory.mathcs.backport.java.util,edu.emory.mathcs.backport,com.springsource.edu.emory.mathcs.backport,3.1.0
edu.emory.mathcs.backport.java.util.concurrent,edu.emory.mathcs.backport,com.springsource.edu.emory.mathcs.backport,3.1.0
edu.emory.mathcs.backport.java.util.concurrent.atomic,edu.emory.mathcs.backport,com.springsource.edu.emory.mathcs.backport,3.1.0
edu.emory.mathcs.backport.java.util.concurrent.helpers,edu.emory.mathcs.backport,com.springsource.edu.emory.mathcs.backport,3.1.0
edu.emory.mathcs.backport.java.util.concurrent.locks,edu.emory.mathcs.backport,com.springsource.edu.emory.mathcs.backport,3.1.0
org.apache.commons.dbcp,org.apache.commons,com.springsource.org.apache.commons.dbcp,1.2.2.osgi
org.apache.commons.logging,commons-logging,commons-logging,1.1.1
org.slf4j,org.slf4j,org.slf4j,1.5.1

Manifest

Usage:
  merry manifest [flags]

Flags:
  -e, --excludeSource   is with exclude source file
  -x, --extract         extract manifest file from jar
  -f, --filter string   filter
  -h, --help            help for manifest
  -m, --merge           is merge package
  -p, --path string     path (default ".")
  -s, --scan            scan manifest file to graphviz
  -v, --version         show manifest version info of jar

examples:

merry manifest -s -x -f org.eclipse.equinox -p ~/sdk/equinox-SDK-4.15/plugins

Generate Pom from jars

merry pom -p _fixtures/demo -m _fixtures/map/map.csv

Call Graph by Manifest.MF

Flags:
  -h, --help          help for call
  -m, --map string    map file
  -p, --path string   path (default ".")
  -s, --server        with server

full steps:

merry manifest -s -p ~/sdk/apache-karaf-4.2.9/lib/boot  -x
merry map -p ~/sdk/apache-karaf-4.2.9/lib/boot
merry call -p ~/sdk/apache-karaf-4.2.9/lib/boot -m map.csv

results:

Call Graph

show only one line with strict

strict digraph G {
  a -> b [ label = "foo" ];
  a -> b [ label = "bar" ];
}

Call Server

cmd: merry call -s

merry will read manifest-map.json and start to http://localhost:3000:

example: https://phodal.github.io/merry/demo

Todo

Todo:

  • Ant to Maven
    • dependencies convert
    • Checksum File
    • Unzip file
    • Parse Manifest
  • Dup Search. search all jars and find not in nexus package
  • POM generate dep graph
  • jar auto rename
    • use POM rename jar
  • custom version
    • configurable
    • from jar to map.csv

License

@ 2020 A Phodal Huang's Idea. This code is distributed under the MPL license. See LICENSE in this directory.