Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

44 řádky
833 B

  1. #!/bin/bash
  2. function die () {
  3. echo "${1}" && exit 1
  4. }
  5. BASE=$(cd $(dirname $0) && pwd)
  6. POM=${BASE}/pom.xml
  7. if [ -n "${1}" ] ; then
  8. POM="${1}"
  9. fi
  10. collecting=0
  11. in_comment=0
  12. cat ${POM} | while read line ; do
  13. if [ -z "${line}" ] ; then continue; fi
  14. if [[ "${line}" =~ "<!--" ]] ; then
  15. if [ ${in_comment} -ne 0 ] ; then die "Cannot nest XML comments" ; fi
  16. in_comment=1
  17. fi
  18. if [ ${in_comment} -eq 1 ] ; then
  19. if [[ "${line}" =~ "-->" ]] ; then
  20. in_comment=0
  21. continue
  22. fi
  23. fi
  24. if [ $(echo "${line}" | tr -d '[:blank:]') = "<properties>" ] ; then
  25. collecting=1
  26. continue
  27. fi
  28. if [ ${collecting} -eq 1 ] ; then
  29. if [ $(echo "${line}" | tr -d '[:blank:]') = "</properties>" ] ; then
  30. break
  31. fi
  32. echo ${line} | tr '<>' ' ' | awk '{print " -D"$1"="$2}' | tr -d '\n'
  33. fi
  34. done