How can I make maven fail on Windows if it is not running as Administrator -
i have maven project builds installer, part of process needs running in administrator cmd shell. bad thing run 15 minutes , happily produce wrong output if not running admin. make maven exit error if not running admin. easy way this?
i approach problem executing batch @ start of build, , fail build if batch not detect admin mode (and returns specific failure code).
to more precise:
- executing batch can done
maven-exec-plugin
. have bindvalidate
phase in order execute right @ start of build (https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html). - the content of batch you. mean admin ? can try create file in c:\ example , return error code if fails.
- finally can use
successcodes
ofmaven-exec-plugin
make build fail if not admin. parameter documented here: http://www.mojohaus.org/exec-maven-plugin/exec-mojo.html#successcodes
Comments
Post a Comment