diff --git a/productized/remove_modules.sh b/productized/remove_modules.sh
index 3fa7a02b44..158fcd241c 100755
--- a/productized/remove_modules.sh
+++ b/productized/remove_modules.sh
@@ -22,7 +22,11 @@ do
modules_list=$(echo $modules | tr "," "\n")
for module in ${modules_list}
do
+ if ! grep -Rq "${module}" ${pom} ; then
+ echo "Could not find module ${module} in ${pom}. Exiting script..."
+ exit 1
+ fi
echo "Removing module ${module} from ${pom}"
- sed -i "/${module}<\/module/d" ${pom}
+ sed -i "/${module}<\/module>/d" ${pom}
done
done
\ No newline at end of file