plugins Ġ{ ĊĠĠĠ Ġjava Ċ } Ċ Ċ repositories Ġ{ ĊĠĠĠ Ġmaven Central () Ċ } Ċ Ċ dependencies Ġ{ ĊĠĠĠ Ġ// ĠWe Ġshould Ġuse Ġa Ġlegacy Ġversion Ġto Ġsupport Ġrunning Ġon Ġj dk 6 ĊĠĠĠ Ġimplementation (" commons - lang : commons - lang : 2 . 6 ") ĊĠĠĠ Ġtest Implementation (" junit : junit : 4 .+ ") Ċ } Ċ Ċ // Ġtag :: java - cross - compilation [] Ċ require ( has Property (" java Home ")) Ġ{ Ġ" Set Ġthe Ġproperty Ġ' java Home ' Ġin Ġyour Ġyour Ġgradle . properties Ġpointing Ġto Ġa ĠJava Ġ 6 Ġor Ġ 7 Ġinstallation " Ġ} Ċ require ( has Property (" target Java Version ")) Ġ{ Ġ" Set Ġthe Ġproperty Ġ' target Java Version ' Ġin Ġyour Ġyour Ġgradle . properties Ġto Ġ' 1 . 6 ' Ġor Ġ' 1 . 7 '" Ġ} Ċ Ċ val Ġjava Home : ĠString Ġby Ġproject Ċ val Ġtarget Java Version : ĠString Ġby Ġproject Ċ Ċ java Ġ{ ĊĠĠĠ Ġsource Compatibility Ġ= ĠJava Version . to Version ( target Java Version ) Ċ } Ċ Ċ val Ġjava Exec ut ables Path Ġ= ĠFile ( java Home , Ġ" bin ") Ċ fun Ġjava Executable ( exec Name : ĠString ): ĠString Ġ{ ĊĠĠĠ Ġval Ġexecutable Ġ= ĠFile ( java Exec ut ables Path , Ġexec Name ) ĊĠĠĠ Ġrequire ( executable . exists ()) Ġ{ Ġ" There Ġis Ġno Ġ${ exec Name } Ġexecutable Ġin Ġ${ java Exec ut ables Path }" Ġ} ĊĠĠĠ Ġreturn Ġexecutable . toString () Ċ } Ċ tasks . with Type < Java Compile > Ġ{ ĊĠĠĠ Ġoptions . apply Ġ{ ĊĠĠĠĠĠĠĠ Ġis Fork Ġ= Ġtrue ĊĠĠĠĠĠĠĠ Ġfork Options . java Home Ġ= Ġfile ( java Home ) ĊĠĠĠ Ġ} Ċ } Ċ tasks . with Type < Javadoc > Ġ{ ĊĠĠĠ Ġexecutable Ġ= Ġjava Executable (" javadoc ") Ċ } Ċ tasks . with Type < Test > Ġ{ ĊĠĠĠ Ġexecutable Ġ= Ġjava Executable (" java ") Ċ } Ċ tasks . with Type < Java Exec > Ġ{ ĊĠĠĠ Ġexecutable Ġ= Ġjava Executable (" java ") Ċ } Ċ // Ġend :: java - cross - compilation [] Ċ Ċ tasks . with Type < Test > Ġ{ ĊĠĠĠ Ġsystem Property (" target Java Version ", Ġtarget Java Version ) Ċ } Ċ Ċ task (" check Javadoc Output ") Ġ{ ĊĠĠĠ Ġdepends On ( tasks [" javadoc "]) ĊĠĠĠ Ġdo Last Ġ{ ĊĠĠĠĠĠĠĠ Ġrequire ( File ( the < Java Plugin Convention >(). docs Dir , Ġ" javadoc / org / gradle / Person . html "). read Text (). contains ("< p > Re presents Ġa Ġperson .</ p > ")) ĊĠĠĠ Ġ} Ċ } Ċ Ċ tasks [" build "]. depends On (" check Javadoc Output ") ĊĊ