After Google code was discontinued, I am pulling my project out of there as needed. Hopefully I'll get all of them before they shut it down for good.

This one is already deleted, so I had to find it in an old SVN repo at one of of old drives.


MavenHoe turns a directory into a Maven repository.

Here's how it works:


Mavenhoe – fake Maven repository from .jar's in local directory tree


QA dept often needs to  run a maven project with "faked" dependencies - the actual .jar files  must be taken from a product's distribution, which are not in any Maven  repository (like EAP's .zip or RPM distribution).


This  utility is one of the ways to solve this problem. It scans a given  directory for .jar files, indexes them, and opens a server acting as a  Maven repository, in the sense of serving the indexed .jar files.


Which file will be served is determined by match of  strings in the provided Maven URL path  (localhost:17283/<group>/<artifact>/<version>/<filename>.jar).  This algorithm is a matter of future improvement. Using static mapping  file is a possibility.




Maven project  preparation


Optionally disable the central repository if  you shouldn't need it - i.e. all your dependencies should be in the  directories indexed by Mavenhoe.

See . One (IMO the best) option is to override it in pom.xml:




Add  Mavenhoe repository to your pom.xml:



Alternatively,  you can also add the repo to ~/.m2/settings.xml (or  any path and use `mvn -s settings-local.xml`):


<?xml version="1.0" encoding="UTF-8"?>


    <!-- Mavenhoe fake repository -->


Mapping  file

Mapping file tells Mavenhoe which file should be served for  certain G:A:C:V axes.

You can provide multiple mapping files,  using parameter -map <path/map.txt>


An  example of such file is the attached to :


# Format:

# <real-file-name>    <groupId>                  <artifactId> [@<cls>] <version>    <virtual-file-name>

jboss-managed.jar      org/jboss/man/            jboss-managed        2.1.0.SP1    jboss-managed-2.1.0.SP1.jar
getopt.jar            gnu-getopt/                getopt                1.0.12-brew  getopt-1.0.12-brew.jar
jboss-kernel.jar      org/jboss/microcontainer/  jboss-kernel          2.0.6.GA      jboss-kernel-2.0.6.GA.jar
jboss-logging-spi.jar  org/jboss/logging/        jboss-logging-spi    2.1.0.GA      jboss-logging-spi-2.1.0.GA.jar



The  first column is path to a file which should be served (base  dir is the current) to Maven client.

Further columns are: groupId (with either  slashes or dots), artifactId, [@classifier,]  version, artifact file name, respectively.

Classifier can be optionally specified at fourth column, prepended with @  (shifting all remaining columns).


For JBoss  products, these information info will be acquired from an online  database (see ).



Command line options

Command  Format (hopefully the syntax is clear ):


mavenhoe [-sp] ( -map [-fakepoms] <map.txt> | -i [-fakepoms] <dir> | -ipom <dir> )+


Header  1Header  2
-i [-fakepom]  <path/to/dir>

Indexes .jar files in this dir tree.

G:A:V used:

1) META-INF/pom.xml if  present.

2) filename : filename : MANIFEST.MF's  Implementation-Version.

-ipom  <path/to/dir>As with -i,  only searches for pom.xml files.
-map [-fakepom] <path/map.txt>Mapping  file to be used by FileBasedMapper.
-spStrip paths from the 1st column in all map files. (applies  to all -map's).

Applied to next dir tree; Mavenhoe will serve fake .pom files with no dependencies.

G:A:C:V used are as described above.



Meta  URLs



            Will list all indexed jars.



            Will list FileBasedMapper's maps.



            Shuts the server down.

Artifact URLs


HTTP codeMeaning


Requested  artifact was found, and is server in the response body. See the DEBUG  log messages for details.
400Wrong  G:A:V path - not in a format <groupId>/<artifactId>/<version>/<filename>.<packaging> .
403Payment required - send  donation to author's PayPal .-)
404Requested  artifact was not found. See DEBUG logs what was searched.
409FileBasedMapper  found a match in a mapping file, but the referenced artifact file does  not exist (nothing to serve).
500Internal  exception - bug in the app.




-  Should give 404



-  Should let you download the hibernate-core-3.3.2.GA_CP03.jar



Build  process tips


To ensure that your dependencies are not  downloaded from local Maven repository, wipe them out:

mvn build-helper:remove-project-artifact


To  use trully "local" repository solely for one project, set it to be in a  directory.

This can be done by using modified settings.xml.


cp ~/.m2/settings.xml ./settings-local.xml

sed "s|<localRepository>\(.*\)</localRepository>|<localRepository>local_repo</localRepository>|" -i settings-local.xml
mvn -s settings-local.xml ...


Sample  log output


2010-12-10 00:38:25,692 DEBUG  Looking for: jdom : jdom : 1.0 : jdom-1.0.jar
2010-12-10 00:38:25,693 DEBUG  Looking for: jdom : jdom : 1.0 : jdom-1.0.jar
2010-12-10 00:38:25,693 DEBUG    Thus  for: 'jdom:jdom'
2010-12-10 00:38:25,693 DEBUG    Supposed file name: null
2010-12-10 00:38:25,693 DEBUG  Looking for: jdom : jdom : 1.0 : jar = jdom-1.0.jar
2010-12-10 00:38:25,693 DEBUG    Supposed file name: jdom
2010-12-10 00:38:25,693 DEBUG

  Found: JarInfo{ name: jdom, version: 5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028),

                  group: null,

                  path: eap/jboss-eap-5.1/jboss-as/server/production/deploy/admin-console.war/WEB-INF/lib/jdom.jar,

                  base: eap }