Native Integration Unavailable Exception for ProjectBuilder

Dear Gradle experts,

I tried to test my custom plugin on Java:

@Test(groups = “upload”)
public void testUploadGradlePlugin() {

    Project project = ProjectBuilder.builder().build();
    project.getPluginManager().apply(TestIQPlugin.class);  //TestIQPlugin is the custom plugin class name
    UploadTask uploadTask = project.getTasks().create("testiqUploadTaskTest", UploadTask.class); 

It compiles fine but runtime hit exception:

Exception in thread “main” java.lang.NoClassDefFoundError: net/rubygrapefruit/platform/NativeIntegrationUnavailableException
at org.gradle.testfixtures.internal.ProjectBuilderImpl.createProject(

By the way, I executed the code from Java’s main method. I appreciate any kind of help.

Well, testing doesn’t work like that. The error you get is because you miss some dependencies, used by Gradle.
One of the easiest way to test your plug-in is to use the gradle test kit

Thanks a lot for the advice!