title: Custom Gradle Task to save parsed Json to file. Android
body: <p>I want to automate the parsing and saving of a json object to asset or raw directory during gradle build. I have a java Json parsing class and I know how to run it from gradle. What i do not know is how to save the results or that class to either of the above folders. Below is an example of how i will be running the script. Is what i am trying to do possible in its current state?? </p>
  
  <pre><code>package com.mrhaki.java;
  
     public class SimpleParser {
         public static void main(String[] args) {
           //parse content
         }
     }
  </code></pre>
  
  <p>Gradle Build</p>
  
  <pre><code>apply plugin: 'java'
  
  task(runSimpleParser, dependsOn: 'classes', type: JavaExec) {
      main = 'com.mrhaki.java.SimpleParser'
      classpath = sourceSets.main.runtimeClasspath
      args 'mrhaki'
      systemProperty 'simpleparser.message', 'Hello '
  
  }
  defaultTasks 'runSimpleParser'
  </code></pre>