Gradle Jar task not working

Hi ,
I am trying to create a jar with the contents from scr/main/java into clients directory with the below snippet from my build.gradle,

     apply plugin: 'java'    
                jar {
		      into file('clients') {
		         from file('src/main/java/gen')

But i am getting an error (Could not find method jar() for arguments) while running the task.
Can someone please suggest me the right approach.