I am trying to call the gradle copy task inside a custom gradle task that I have written in java:
Copy copy = new Copy(); copy.from(genClasses.getPath()); copy.setDestinationDir(outputFolder); copy.execute();
but when I run the above task I get:
Task of type ‘org.gradle.api.tasks.Copy’ has been instantiated directly which is not supported. Tasks can only be created using the DSL.
What is the correct way to call the copy task from gradle? Or is it better to simply use common-io instead?