title: How to get Android Studio main SourceSet with Gradle API?
body: <p>I'm working on developing a gradle plugin for Android Studio.Here is my problem <strong>How can I get Android Studio main SourceSet with Gradle API?</strong>  </p>
  
  <p>I want to do some copy stuff with java source directory.
  Before asking this question, I found something useful but not work.</p>
  
  <pre><code>SourceSet main = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME)
  </code></pre>
  
  <p>I get this error message<br>
  <code>Caused by: org.gradle.api.UnknownDomainObjectException: SourceSet with name 'main' not found.</code></p>