Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bodar/shavenmaven

A tiny dependency resolver for Java
https://github.com/bodar/shavenmaven

Last synced: 14 days ago
JSON representation

A tiny dependency resolver for Java

Awesome Lists containing this project

README

        

## Example ##

Create a text file with some dependencies in it. Lets call it `build.dependencies`

```
# This is a comment
mvn:org.hamcrest:hamcrest-core:jar:1.2.1
mvn://repo.bodar.com/com.googlecode.totallylazy:totallylazy:pack|sources:1125
s3://repo.bodar.com/com.googlecode.yadic:yadic:jar:151
http://jarjar.googlecode.com/files/jarjar-1.1.jar
jar:https://storage.googleapis.com/simba-bq-release/jdbc/SimbaJDBCDriverforGoogleBigQuery42_1.1.0.1000.zip!/GoogleBigQueryJDBC42.jar
file:///home/dan/Project/foo.jar
```

ShavenMaven uses an extended form of the [BuildR](http://buildr.apache.org/) mvn url. (This means when you use sites like http://mvnrepository.com/ you can click on the BuildR tab and just prefix it with "mvn:")

* The first line after the comment will download `hamcrest-core` jar from the central repository.
* The second line will download `totallylazy` [pack200](http://docs.oracle.com/javase/7/docs/api/java/util/jar/Pack200.Packer.html) file (and unpack it to a jar) and sources from a custom repository `repo.bodar.com`.
* The third line will download 'yadic' jar from 'repo.bodar.com.s3.amazonaws.com'
* The fourth line will do a plain HTTP GET request to non mavenised jar.
* The fifth line will download a jar/zip and extract a file inside
* The last line will look for a local file called foo.jar

You can also specify an alternative default repo for mvn urls with
`-Dshavenmaven.default-repository=http://uk.maven.org/maven2/`

### Command line usage ###

To actually download the jars, run the following:
```
java -jar shavenmaven.jar build.dependencies lib/build
```

Where `lib/build` is a directory where you want to download the jars to.

You can also update multiple dependencies files and directories at the same time by providing 2 directories:

```
java -jar shavenmaven.jar build lib
```

This will recursively find all ".dependencies" files in "build" and create a directory with a matching name in "lib" so:

* build/
* build.dependencies
* runtime.dependencies
* optional/
* unix-specific.dependencies
* windows-specific.dependencies

Would create the following structure:

* lib/
* build/
* runtime/
* optional/
* unix-specific/
* windows-specific/

### ANT usage ###

To make life easy in ANT, ShavenMaven provides a [macro file](src/shavenmaven.xml).
Obviously ANT is xml based but it's all just syntactic sugar over the command line interface.

Importing this macro file will allow you to install ShavenMaven with a single line:

```

```

You can then update a directory just like in the command line version

```

```

or to do multiple files and directories in one go

```

```

You can also generate a maven pom from the dependencies file with something like:

```

```

If you want to see all of this put together have a look at ShavenMavens [build file](build.xml)