Running Maven in the first ancestor dir that contains a pom.xml file
Posted: Wed Feb 29, 2012 7:50 pm
Hi there,
Our projects are use Maven and are set up such that the xml files are at various depths in a directory tree and there is a pom.xml file in a containing folder. So you might have:
project-name/pom.xml
project-name/src/docbkx/somefile.xml
project-name/src/docbkx/chapters/somechapter.xml
I'd like to set up an External Tool to kick off Maven such that it works even if you're editing somechapter.xml (i.e. a file not in the same dir as pom.xml). I thought I'd write a simple shell script that walks up the tree until it finds a pom file and then runs maven on it:
I figured I could store the script in my framework and have the external tool invoke it from there, but when I try, I always get errors like:
Is there a way to do what I want? I.e. run mvn against the pom even if the pom is in some directory above the currently edited file (and the number of levels up is an arbitrary number)?
Thanks,
David
Our projects are use Maven and are set up such that the xml files are at various depths in a directory tree and there is a pom.xml file in a containing folder. So you might have:
project-name/pom.xml
project-name/src/docbkx/somefile.xml
project-name/src/docbkx/chapters/somechapter.xml
I'd like to set up an External Tool to kick off Maven such that it works even if you're editing somechapter.xml (i.e. a file not in the same dir as pom.xml). I thought I'd write a simple shell script that walks up the tree until it finds a pom file and then runs maven on it:
Code: Select all
while true; do [ -f pom.xml ] && break; cd ..; done; mvn clean generate-sources
Code: Select all
Could not start: Cannot run program "/home/dcramer/.local/share/applications/Oxygen13-2/frameworks/rackbook/test2.sh
" (in directory "/home/dcramer/Documents/rax/rackspace-template/src/docbkx"): java.io.IOException: error=2, No such file or directory
Process ended with exit code: -1234567
Thanks,
David