Skip to content

israelglory/jpm

Repository files navigation

JPM (Java Package Manager)

JPM is a Java CLI tool that adds Maven dependencies to pom.xml using simple aliases.

MVP commands

jpm add postgres
jpm add lombok
jpm add web

What it does

  • Parses terminal commands
  • Detects pom.xml
  • Resolves aliases to Maven coordinates
  • Fetches the latest version from Maven Central
  • Updates pom.xml using DOM XML parsing
  • Prevents duplicate direct dependencies
  • Saves the modified file safely

Installation & Distribution

From GitHub Releases (recommended)

Use the automated installer:

curl -sSL https://raw.githubusercontent.com/israelglory/jpm/main/install-jpm.sh | bash -s -- v1.0.3

Or specify latest:

curl -sSL https://raw.githubusercontent.com/israelglory/jpm/main/install-jpm.sh | bash -s -- latest

Project structure

src/main/java/com/jpm/
├── Main.java
├── Dependency.java
├── DependencyResolver.java
├── MavenCentralClient.java
└── PomEditor.java

Why the classes exist

  • Main.java – CLI entrypoint, command parsing, and user-facing messages
  • Dependency.java – immutable dependency model
  • DependencyResolver.java – maps aliases to real Maven coordinates and asks Maven Central for the latest version
  • MavenCentralClient.java – performs the HTTP request to Maven Central
  • PomEditor.java – reads and updates pom.xml with DOM APIs

Build requirements

  • Java 17+
  • Maven 3.9+

Compile

cd /Users/user/Documents/Backend/jpm
mvn clean package

Run locally

From the directory that contains your Maven project pom.xml:

java -jar target/jpm-1.0.0.jar add postgres

Or use the local launcher:

./bin/jpm add postgres

Or run directly from compiled classes:

mvn -q compile
java -cp target/classes Main add lombok

Package into an executable JAR

mvn clean package

The JAR will be at target/jpm-1.0.3.jar.

Homebrew (if you set up a tap)

brew tap your-org/jpm https://github.com/israelglory/homebrew-jpm
brew install your-org/jpm/jpm

Release Workflow

  1. Update CHANGELOG.md with new version and changes.

  2. Update pom.xml version (e.g., 1.0.0 for releases, 1.0.1-SNAPSHOT for dev).

  3. Commit and push:

    git add CHANGELOG.md pom.xml
    git commit -m "Release v1.0.0"
    git tag -a v1.0.0 -m "JPM v1.0.0"
    git push origin main
    git push origin v1.0.0
  4. GitHub Actions automatically:

    • Builds the JAR
    • Generates checksums
    • Creates a GitHub Release with JAR and checksums attached
  5. Verify the release on GitHub Releases.

Version

Check the version:

jpm --version
# or
jpm version

Support & Contributions

The JAR will be created in target/ and contains a manifest that points to Main.

Expected output

Success:

✔ Dependency added successfully

Duplicate:

✔ Dependency already exists

Missing pom.xml:

✘ No pom.xml found

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors