Most of the Java projects I work on use Maven as the project management tool. I’ve written some command line tools to make life easier for myself, here is one of them.

pom.sh (version 0.6.1) [PGP signature: pom.sh.asc]

Maven pom.xml-file inspector command. It’s small, written in plain Bourne shell and only requires xsltproc to work.

Version 0.6.1

Simplify specifying a different POM file rather than looking in current directory. (The “-f”/”–file” option is removed. Just specify dir or file directly.)

Version 0.6

  • When selecting a profile, don’t hide global data common to all profiles. Show profile-specific data appended to global data.
  • Support display of generated effective POM (requires invocation of Maven).
  • Support resolving complete dependency list (requires invocation of Maven).
  • Fix display of transitive exclusions per dependency.
  • Show parent POM artifact info as part of basic metadata if present.

POM XML files can contain a lot of dependencies and tend to get extremely verbose, making them hard to read. When invoked, pom.sh extracts essential data from the pom.xml file in the current directory (or any parent directory) and displays it in compact and readable plain text in your terminal. See «pom -h» for documentation. Options `–resolve’ and `–effective’ require that you have a functioning Maven installation and the `mvn’ command in your PATH.

Example output:

$ pwd
$ pom
POM file         ~/Projects/superproject/pom.xml
Name             The Super Project
GroupId          super
ArtifactId       super
Version          0.1-SNAPSHOT
Profiles         dev, test

Distribution repository URL:

Defined repository URLs:

Build plugins:
  maven-release-plugin                          org.apache.maven.plugins:maven-site-plugin
  org.antlr:antlr3-maven-plugin:3.1.3-1         org.apache.maven.plugins:maven-war-plugin
  org.apache.maven.plugins:maven-antrun-plugin  org.codehaus.mojo:javacc-maven-plugin

Direct dependencies:
  cglib:cglib-nodep:2.1_3                        org.apache.ibatis:ibatis-sqlmap:
  com.ibm.icu:icu4j:3.8                          org.apache.lucene:lucene-core:2.4.1
  commons-codec:commons-codec:1.3                org.apache.lucene:lucene-queries:2.4.1
  commons-collections:commons-collections:3.2.1  org.apache.maven.doxia:doxia-module-apt:1.0-alpha-11
  log4j:log4j:1.2.15                             org.springframework:spring:2.5.6.SEC01

Exclusions of transitive dependencies:
  Excluded for log4j:log4j