How to strat netbeans platform from gradle task to build java modules

I am developing a java application.I need to build it using netbeans which should be run as separate task in gradle.I have netbeans distribution.My task has to download the distribution and start netbeans with java project properties as argument to netbeans.Please provide any specific solution for this