throw new GradleException("conditions are not met") 参考 How to fail/stop task immediately if some conditions are not met