Maven Bin Core

Install and run executable libraries from Maven repos.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

me.andrz.maven
ArtifactId

ArtifactId

maven-bin-core
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Maven Bin Core
Install and run executable libraries from Maven repos.
Project URL

Project URL

https://github.com/adjohnson916/maven-bin
Source Code Management

Source Code Management

https://github.com/adjohnson916/maven-bin

Download maven-bin-core

How to add to project

<!-- https://jarcasting.com/artifacts/me.andrz.maven/maven-bin-core/ -->
<dependency>
    <groupId>me.andrz.maven</groupId>
    <artifactId>maven-bin-core</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/me.andrz.maven/maven-bin-core/
implementation 'me.andrz.maven:maven-bin-core:1.0.0'
// https://jarcasting.com/artifacts/me.andrz.maven/maven-bin-core/
implementation ("me.andrz.maven:maven-bin-core:1.0.0")
'me.andrz.maven:maven-bin-core:jar:1.0.0'
<dependency org="me.andrz.maven" name="maven-bin-core" rev="1.0.0">
  <artifact name="maven-bin-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.andrz.maven', module='maven-bin-core', version='1.0.0')
)
libraryDependencies += "me.andrz.maven" % "maven-bin-core" % "1.0.0"
[me.andrz.maven/maven-bin-core "1.0.0"]

Dependencies

compile (11)

Group / Artifact Type Version
org.codehaus.groovy : groovy-all jar 2.4.2
org.eclipse.aether : aether-api jar 1.0.2.v20150114
org.eclipse.aether : aether-spi jar 1.0.2.v20150114
org.eclipse.aether : aether-util jar 1.0.2.v20150114
org.eclipse.aether : aether-impl jar 1.0.2.v20150114
org.eclipse.aether : aether-connector-basic jar 1.0.2.v20150114
org.eclipse.aether : aether-transport-file jar 1.0.2.v20150114
org.eclipse.aether : aether-transport-http jar 1.0.2.v20150114
org.slf4j : slf4j-simple jar 1.7.10
org.apache.maven : maven-core jar 3.3.1
org.apache.commons : commons-lang3 jar 3.4

test (3)

Group / Artifact Type Version
junit : junit jar 4.11
org.hamcrest : hamcrest-all jar 1.3
com.jcabi : jcabi-matchers jar 1.3

Project Modules

There are no modules declared in this project.

maven-bin

Maven Central Travis Appveyor Codecov

A CLI to install & run executable libraries from Maven repositories, with automagic classpathing of dependencies, and aliases on your global path. Sort of like npm's install --global.

Features

  • With a single command, install JARs and execute their main classes.
  • Install from any Maven repo, off or on-prem, e.g. Bintray, Artifactory, Archiva, or Nexus, via settings.xml.

Use

Executing

Executing a library will be sure it and all its dependencies are downloaded, then run a class in the JAR, defaulting to its main class.

mvbn org.apache.ant:ant -help

Or the long way:

mvn me.andrz.maven:maven-bin-maven-plugin:exec "-Dartifact=org.apache.ant:ant" "-Darguments=-help"

Non-Main Classes

Non-main classes can be specified with an @... suffix on the artifact coordinates, e.g.:

mvbn org.antlr:[email protected]

Installing

Installing a library will first download as above, then create an executable script file as a shortcut to execute it.

mvbn -i org.apache.ant:ant

Or the long way:

mvn me.andrz.maven:maven-bin-maven-plugin:install "-Dartifact=org.apache.ant:ant"

Now, you'll have a command for it, e.g.:

ant--org.apache.ant--1.9.6

But you'll probably want to specify aliases.

Aliases

mvbn -i -a ant org.apache.ant:ant

Or the long way:

mvn me.andrz.maven:maven-bin-maven-plugin:install "-Dartifact=org.apache.ant:ant" "-Dalias=ant"

Now, you'll have a command for it:

ant

Classpaths

Get the classpath for an artifact:

mvbn -c org.antlr:antlr4

For example, to use when compiling:

javac -cp "$(mvbn -c org.antlr:antlr4)" MyGrammar*.java

Install

General

To install maven-bin:

1. Install Core

mvn me.andrz.maven:maven-bin-maven-plugin:installSelf

2. Add to PATH

Add ~/.mvbn/bin to your system executable PATH.

Unix (macOS, Linux, etc.)

In your shell startup script (e.g. .profile, .bashrc, .bash_profile, .zshrc), add something like:

MAVEN_BIN="${HOME}/.mvbn/bin"
if [ -d "${MAVEN_BIN}" ]; then
  export PATH="${MAVEN_BIN}:$PATH"
fi
Windows

In your PowerShell profile, add something like:

$env:Path = $env:Path + ";${env:UserProfile}\.mvbn\bin;"

Development

git clone https://github.com/AndersDJohnson/maven-bin.git
cd maven-bin
mvn install

Wishlist

  • Aliasing (default group ID and versions)
    • Add aliased command executables to global path
  • Auto-complete CLI
    • Maybe via a generic Groovy CliBuilder completion integration for Bash, zsh, PowerShell, etc.?
  • Search repos

Dev

Set log level for slf4j simple:

Just this package:

org.slf4j.simpleLogger.log.me.andrz.maven.bin=debug

Or default (all packages):

-Dorg.slf4j.simpleLogger.defaultLogLevel=debug

Research

mvn dependency:copy "-Dartifact=org.apache.ant:ant:RELEASE" "-DoutputDirectory=./bin"
mvn dependency:get "-Dartifact=org.apache.ant:ant:RELEASE"
mvn -f "C:\Users\Anders\.m2\repository\com\google\guava\guava\18.0\guava-18.0.pom" org.apache.maven.plugins:maven-dependency-plugin:2.10:build-classpath
mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:build-classpath "-Dmdep.outputFile=foo"
mvn -f .\mvn help:effective-pom

Versions

Version
1.0.0