Can't Compile annotation although dependencies exists

I’m trying to create JAVA custom task using Gradle, this task run another JAVA classes

package com.carseed.modules.build.ant;

import java.io.*;

import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.TaskAction;

import com.carseed.util.db.patch.DbPatchSystem;

public class DbGradlePatcher extends DefaultTask {
      private DbPatchSystem patcher;

   @TaskAction
    public void verify() throws GradleException {
        try
        {
            patcher.run();
        }
        catch (Exception e)
        {
            throw new GradleException( "Error : ", e );
        }
    }

    @Option(option = "dbxmlfile", description = "dbxmlfile")
    public void setDbXmlFile(String dbxmlfile) {
        this.patcher.setDbxmlfile(parseAntArgument(dbxmlfile));
    }

}

build.gradle

plugins {
    id 'java'
    id 'application'
    id 'java-library'
    id 'java-gradle-plugin'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
    mavenLocal()
    flatDir {
        dirs deployRoot + "/WEB-INF/lib"
        dirs deployRoot + "/WEB-INF/classes"
    }
}
dependencies {
    implementation gradleApi()
    api fileTree(deployRoot + "/WEB-INF/lib")
    api fileTree(deployRoot + "/WEB-INF/classes")
}

sourceSets {
    main.java.srcDirs = ["src/main/java/com/atypon/modules/build/ant"]
    main.java.outputDir = file(taskTargetClasspath)
}

tasks.register('patchtool', DbGradlePatcher.class)

patchdef{
        patch="${patch}"
        database="${database}"
        server="${server}"
}

But When it comiles without issues it doesn’t register the custom task, so I checked online I added the above plugins and it doesn’t compile.

DbGradlePatcher.java:304: error: cannot find symbol
    @Option(option = "dbxmlfile", description = "dbxmlfile")
     ^
  symbol:   class Option
  location: class DbGradlePatcher
28 errors

What I’m missing here?

The code for DbGradlePatcher has no import org.gradle.api.tasks.options.Option.