UploadTask from Gradle Standalone Plugin

Hello guys, I am trying to build a standalone plugin, everything goes rather smoothly, but I need to configure uploadArchives task. I am using Java. How am I supposed to configure it?

I am trying to do the following, but I can’t make heads or tails of it.

Upload uploadArchivesTask = (Upload)project.getTasks().findByName("uploadArchives");
uploadArchivesTask.repositories().maven()

Is there any form of example how to do it?