Thanks Vincent, I have added this contribution to our wiki:
http://wiki.restlet.org

Best regards,
Jerome  

> -----Message d'origine-----
> De : news [mailto:[EMAIL PROTECTED] De la part de Vincent
> Envoyé : jeudi 18 janvier 2007 20:36
> À : [email protected]
> Objet : Script to install a Restlet distribution into a 
> maven2 repository
> 
> Hi all,
> 
> I use this bash  script to upgrade my local maven2 repository 
> each time a new version of Restlet comes up.
> Some of you might find it useful.
> 
> -Vincent.
> 
> #!/bin/bash
> #
> # This script installs a Restlet disrtribution  into a local 
> (filesystem)
> # maven2 repository.
> #
> # Usage: restlet2mvn.bsh <path to Restlet distribution > 
> <path to local maven
> repository>
> #
> 
> if [ $# -le 1 ]; then
>    echo "Usage: restlet2mvn.bsh <path to Restlet distribution 
> > <path to local
> maven repository>"
>    exit 1;
> fi
> RESTLET_DIST=$1
> MAVEN_REPOSITORY=$2
> MVN=mvn
> 
> if [ ! -e $RESTLET_DIST ]
> then
>    echo "Restlet distribution not found: $RESTLET_DIST"
>    exit 1;
> fi
> 
> if [ ! -e $MVN_REPO ]
> then
>    echo "Maven repository not found: $MVN_REPO"
>    exit 1;
> fi
> 
> LIB_DIR=$RESTLET_DIST/lib
> POMS_DIR=$RESTLET_DIST/lib/poms
> 
> poms=`ls $POMS_DIR/*.pom`
> 
> 
> for pom in $poms
> do
>  #  restlet/lib/poms/foo.pom -> restlet/lib/foo.jar
>  jar=`echo $pom | sed s/.pom$/.jar/g | sed s/poms\\\///g`
>  if [ -e $jar ]
>   then
>    # Extract the group, artifact id, and version number from the POM:
>    # We assume that the first <groupId>, <artifactId>, 
> <version> tags found in
> the pom
>    # contain the module's group id, artifact id, and version #.
>    # This will break if the pom contains commented out tags:
>    #      <groupId>foo<.groupId>
>    #      <!-- <artifactId>bar</artifactId> -->
>    #      <artifactId>bar</artifactId>
>    #      <versio>1.0</version>
>    group=` grep --regexp '<groupId>.*</groupId>' 
> --max-count=1   $pom | sed
> 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
>    artifact=` grep --regexp '<artifactId>.*</artifactId>' 
> --max-count=1   $pom |
> sed 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
>    version=` grep --regexp '<version>.*</version>' 
> --max-count=1   $pom | sed
> 's/[[:space:]]*<[^><]*>[[:space:]]*//g' `
>    # Now deploy the module
>    $MVN   deploy:deploy-file -DgroupId=$group \
>           -DgeneratePom=false \
>           -DpomFile=$pom \
>           -DartifactId=$artifact \
>           -Dversion=$version \
>           -Dpackaging=jar \
>           -Dfile=$jar \
>           -DrepositoryId=local-repository \
>           -Durl=file://$MAVEN_REPOSITORY 
>    
>   fi
> done
> 
> exit
> 

Reply via email to