views:

23

answers:

4

Basically, I have a project and a Continuous Integration solution which I have no admin access to, that can't reach out of our network. Consequently, I want to deploy all of the jars for the project to our central maven repository which the CI solution can reach. They are in my local repo but it's a pretty complicated project. Can't I just set a flag or something and deploy both a jar and what ever else I have in the local repo that the jar depends on?

OK, I've had an idea of my own since I first wrote this. What about this:

  1. Move my local maven repo off to a new name.
  2. Perform a build with -U flag so that a new repo is created with only the things I need for this project.
  3. Perform a merge from the newly created local repo to the remote repo.
A: 

Check out Maven Deploy Plugin description and usage. I think the deploy-file mojo, although intended to deploy artifacts not built by maven, might help you do what you want.

dborba
+1  A: 

What dborba said. I'd write a (bash/ruby) script to run the Maven Dependency Plugin, and then run deploy-file with the GAE attributes as reported by the Dependency Plugin. Assuming I had more than a few dependencies. Some repository managers (e.g. Nexus) are good at working out the GAE info.

Julian Simpson
I like your approach (+1), but I'd do it with Groovy / GMaven, because then you can do it from within the pom: http://docs.codehaus.org/display/GMAVEN/Executing+Groovy+Code
seanizer
A: 

In a blog post I described a similar scenario: Deploying a folder hierarchy to a Maven Repository. It uses GMaven (Groovy embedded in maven). If you take the code from that example, skip the directory walking and walk the project dependencies instead, you should almost be there.

seanizer
A: 

Here is how I wound up handling this:

First I copied my local maven repo off to a new name. Then I ran "mvn -U clean install" ensuring that the resulting local maven repo contained only the jars needed for this specific build. Next I created this script (explained in detail for Windows users):

#!/bin/bash

for I in `find ~/.m2 -name "*.jar"`
do
        J=`echo $I | sed 's/jar$/pom/'`
        mvn deploy:deploy-file -DpomFile=$J -Dfile=$I -Durl=dav:http://maven.our.repo/maven2 -DrepositoryId=sharedRep
done

For those who don't read BASH, it grabs the full path and file names of all jar files in the .m2 subdirectory of the users home directory. This is usually where the user's local repo is located. Then it copies that and changes the file extension from "jar" to "pom" on the copy. Then we execute the maven command below:

mvn deploy:deploy-file -DpomFile=[pom file name here] -Dfile=[jar file name here] -Durl=dav:http://maven.our.repo/maven2 -DrepositoryId=sharedRep

This seems to work OK for getting the libraries in my local repo to the shared repo.