gradle external class required by plugin on runtime : Gents,

I'm creating custom gradle plugin for internal company use. It will add few tasks to project and behaviour of one task can be customized by plugin users. Idea is to have plugin property that will contain external class name. This class must implement appropriate interface to be correctly used. Plugin's task will instantiate objects for this class and use it during execution.

Reasons for that - there are several reasonably different patterns used by different teams in company. So set of these "external classes" will be created and published. Each team can choose which one to use for their build configuration. Or even can create a new one if there are reasons for that. So I want this thing to be configurable on a build level.

I'm failing to setup this kind of dependency in build.gradle script. Let me show you code on whicn I'm trying to reproduce and solve issue:

    buildscript{
        repositories {
            mavenCentral()
            maven{
                url "http://our-internal-nexus/repository/maven-releases/"
            }
            dependencies{
                classpath 'my.company:myplugin:0.1'
    			classpath 'my.other.company:extClass:0.1'
                 
            }
        }
    }
    
    apply plugin: 'my.company.myplugin'
    
    MyInput{
        managerClass = "ExtClass"
    }

myplugin - artifact of my plugin, and extclass - external class that should be instantiated by plugin's task. 

When I try to execute plugins task: *gradle hellotask* I receive error: java.lang.ClassNotFoundException: ExtClass

I put a code to hellotask class definition to show me the classpath. The only thing it shows is C:/work/Projects/development/gradle-4.0.1/lib/gradle-launcher-4.0.1.jar. So for me it looks like no path to extClass jar provided by gradle to plugin in runtime so it can't find it. 

Appreciate any help how to make it work. Below you can find source code of plugin and extClass if this may help.

**MyPlugin**

MyPlugin.java

    package my.company;
    import org.gradle.api.*;
    
    //Plugin definition
    public class MyPlugin implements Plugin<Project>{
        @Override
        public void apply(Project project){
            project.getExtensions().create("MyInput", MyPluginExtension.class);
            HelloTask helloTask = project.getTasks().create("helloTask", HelloTask.class);
        }
    
    }


HelloTask.java

    package my.company;
    
    import java.net.URL;
    import java.net.URLClassLoader;
    import org.gradle.api.*;
    import org.gradle.api.tasks.*;
    
    //Plugin task
    public class HelloTask extends DefaultTask {
    	@TaskAction
        public void action() {
    		
    	//Print classpath
    	ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();
     
    	URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();
    
    	for(int i=0; i< urls.length; i++) 	{
    		System.out.println(urls[i].getFile());
    	}
    	
    	//Try to instantiate class
    	try {
    		MyPluginExtension extension = getProject().getExtensions().findByType(MyPluginExtension.class);
    		Object instance = Class.forName(extension.getManagerClass()).newInstance();
    	}
    	catch (ClassNotFoundException e) {
                e.printStackTrace();
                throw new GradleException("Class not found");
    	} catch (IllegalAccessException e) {
    		e.printStackTrace();
    		throw new GradleException("IllegalAccessException");
    	} catch (InstantiationException e) {
    		e.printStackTrace();
    		throw new GradleException("InstantiationException");
    	}
    		
    	}
    }

MyPluginExtension.java

    package my.company;
    
    public class MyPluginExtension {
        private String managerClass = null;
    
        public String getManagerClass(){return this.managerClass;}
        public void setManagerClass(String managerClass){ this.managerClass = managerClass;}
    
    }

**extClass**

extClass.java

    package my.other.company;
    
    public class ExtClass {
    
        public void ExtClass(){
            System.out.println("Show me how it works!");
        }
    
    }

