maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <joerg.schai...@bpm-inspire.com>
Subject Re: Working with branches related to issue - Simplyfying work Part II
Date Wed, 01 Aug 2018 13:59:03 GMT
Hi Karl-Heinz,

Am Mon, 30 Jul 2018 20:21:13 +0200 schrieb Karl Heinz Marbaise:

> Hi,
> 
> I have finished my write up about my current working scripts to make my
> life easier...
> 
> If someone is interested in take a look at:
> 
> https://blog.soebes.de/blog/2018/07/30/automate-it-part-ii/
> 
> suggestions/ideas are always welcome...

An invaluable source of processing XML files is the xmlstarlet package 
(typically installed as /usr/bin/xml), e.g. for extracting the URL for 
the issues.

Example: I have a short bash script to generate recursively minimal 
Eclipse project files for packaging types that are ignored by the maven-
eclipse-plugin:

========== %< ============
#!/bin/sh

packaging=pom
if [ "$1" = "-p" ]; then
    shift
    packaging=$1
    shift
fi

if [ $# -lt 1 ]; then 
    echo "Usage ${0##*/} [-p packaging] dir ..."
else
    idx=0
    poms=( "$@" )
    while [ $idx -lt ${#poms[@]} ]; do
        pom=${poms[$idx]}/pom.xml
        path=${pom%/*}
        let idx=$idx+1
        if [ -f "$pom" ]; then
            modules=`xml sel -N pom=$XMLNS_POM -t -m pom:project -m 
pom:modules -v pom:module $pom`
            if [ -n "$modules" ]; then
                for module in ${modules[*]}; do
                    poms+=( $path/$module )
                done
            else
                if [ "$packaging" = "`xml sel -N \"pom=$XMLNS_POM" -t -m 
pom:project -v pom:packaging \"$pom\"`" ]; then
                    if [ ! -f "$path"/.project ]; then
                        name=`xml sel -N "pom=$XMLNS_POM" -t -m 
pom:project -v pom:artifactId "$pom"`
                        echo '<projectDescription><name>'"$name"'</name></
projectDescription>' > "$path"/.project && echo "$path/.project"
                    fi
                fi
            fi
        fi
    done
fi
========== %< ============

The variable XMLNS_POM is declared in my .bashrc:

export XMLNS_POM="http://maven.apache.org/POM/4.0.0"

If you look at the script I use xmlstarlet to extract the modules, the 
project name and to compare the packaging type. 

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message