Fix bugs Import cannot be resolved : Java 17

I am quite new to java field learning.

Could you please help me to resolve my issue

Currently what i am doing is trying to create a custom scanner using java

I am good in python but not in java

I will add this code .jar file to external/plugins

Step 1 : I have a python script

Step 2 : This script reads all the files identified when i clone my bitbucket repository

Step 3 : This script is built to scan that .fil files and it generates a generic issue report in .json format for sonarqube.

I am issue in below code

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mycompany</groupId>
  <artifactId>custom-sonarqube-plugin</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>custom-sonarqube-plugin</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.sonarsource.scanner.api</groupId>
      <artifactId>sonar-scanner-api</artifactId>
      <version>2.15.0.2182</version>
    </dependency>
  </dependencies>
</project>

CustomScannerExecutor.java

import org.sonarsource.scanner.api.batch.ScannerSide;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.sensor.Sensor;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.SensorDescriptor;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

@ScannerSide
public class CustomScannerExecutor implements Sensor {
    private static final Logger LOGGER = Loggers.get(CustomScannerExecutor.class);

    @Override
    public void describe(SensorDescriptor descriptor) {
        descriptor.name("Custom Autosys Linter");
    }

    @Override
    public void execute(SensorContext context) {
        try {
            // Define paths
            String pythonScriptPath = "path/to/your/script.py"; // Adjust this path
            String baseDirectory = context.fileSystem().baseDir().getAbsolutePath();
            String outputFilePath = baseDirectory + "/sonar-issues.json";

            // Execute the Python script
            ProcessBuilder processBuilder = new ProcessBuilder(
                "python", pythonScriptPath, baseDirectory, outputFilePath
            );
            Process process = processBuilder.start();
            process.waitFor();

            // Log the script output
            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
            String line;
            while ((line = reader.readLine()) != null) {
                LOGGER.info(line);
            }

            // Import the JSON report
            Path reportPath = Paths.get(outputFilePath);
            if (Files.exists(reportPath)) {
                context.newExternalIssuesLoader().importExternalIssues(
                    reportPath.toFile(),
                    context.config().get("sonar.projectKey").orElse("default")
                );
                LOGGER.info("External issues report imported successfully.");
            } else {
                LOGGER.warn("No issues report found at: " + outputFilePath);
            }
        } catch (Exception e) {
            LOGGER.error("Error executing custom scanner", e);
        }
    }
}

CustomScannerPlugin.java

import org.sonar.api.Plugin;

public class CustomScannerPlugin implements Plugin {
    @Override
    public void define(Context context) {
        context.addExtension(CustomScannerExecutor.class);
    }
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật