Ошибка преобразования java файла с помощью Javac "error: cannot find symbol"

Описание; Есть, например, код;

package Oauth;


import io.restassured.http.ContentType;
import org.awaitility.Awaitility;
import java.util.concurrent.TimeUnit;

import static constants.Constants.ServerConst.Endpoint.COSIAL_PLACE_ENDPOINT_SEARCH;
import static constants.Constants.ServerConst.Path.COSIAL_PLACE_PATH;
import static constants.Constants.ServerName.SOCIAL_PLACE_SERVER;
import static io.restassured.RestAssured.given;

public class Cache {
    String accessToken;


    public void getStatus() {

        try {
            this.accessToken = new PostOAuth().main();
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String boxyJson = "{\"query\":\"query mapSidebarSubjectReports {\\n  reports(districtIds: null, cityIds: null, regionCodes: \\\"77\\\", reportParameters: null) {\\n    id\\n    osm_id\\n    name\\n    reports {\\n      direction {\\n        name\\n        localized\\n        shortname\\n        __typename\\n      }\\n      result\\n      result_18\\n      result_30\\n      result_banned\\n      result_deleted\\n      date\\n      __typename\\n    }\\n    population {\\n      count\\n      type\\n      __typename\\n    }\\n    tension {\\n      percent_all {\\n        direction\\n        date\\n        result\\n        result_30\\n        __typename\\n      }\\n      all {\\n        direction\\n        date\\n        result\\n        result_18\\n        result_30\\n        __typename\\n      }\\n      relative {\\n        direction\\n        date\\n        result\\n        result_18\\n        result_30\\n        __typename\\n      }\\n      percent_young {\\n        direction\\n        date\\n        result\\n        result_18\\n        result_30\\n        __typename\\n      }\\n      young {\\n        direction\\n        date\\n        result\\n        result_18\\n        result_30\\n        __typename\\n      }\\n      percent_relative {\\n        direction\\n        date\\n        result\\n        result_18\\n        result_30\\n        __typename\\n      }\\n      __typename\\n    }\\n    __typename\\n  }\\n}\\n\",\"operationName\":\"mapSidebarSubjectReports\"}";
            String[] array = new String[]{"17", "56", "34", "31", "64", "36", "87", "03", "43", "16", "73", "70", "66", "02", "11", "14", "91", "92", "06", "20", "91", "25", "19", "01", "24", "26", "39", "12", "07", "09", "18", "27", "53", "44", "08", "61", "35", "30", "15", "71", "40", "76", "21", "74", "33", "13", "55", "68", "58", "52", "62", "32", "60", "42", "75", "28", "54", "38", "45", "41", "04", "49", "79", "48", "51", "05", "67", "59", "23", "78", "50", "29", "83", "89", "72", "86", "77", "57", "46", "63", "47", "37", "65", "22", "69", "10"};

            for (int i = 0; i < array.length; i++) {
                String newBodyJson = boxyJson.replace("77", array[i]);

                int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                        .body(newBodyJson)
                        .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                        .then().log().body().extract().statusCode();

                Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> waitForBidResponse == 200);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public void getStatusMapDistricts() {

        try {
            this.accessToken = new PostOAuth().main();
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String boxyJson = "{\"query\":\"query mapDistricts {\\n  districts(regionCode: \\\"24\\\") {\\n    id\\n    name\\n    __typename\\n  }\\n}\\n\",\"operationName\":\"mapDistricts\"}";
            String[] array = new String[]{"17", "56", "34", "31", "64", "36", "87", "03", "43", "16", "73", "70", "66", "02", "11", "14", "91", "92", "06", "20", "91", "25", "19", "01", "24", "26", "39", "12", "07", "09", "18", "27", "53", "44", "08", "61", "35", "30", "15", "71", "40", "76", "21", "74", "33", "13", "55", "68", "58", "52", "62", "32", "60", "42", "75", "28", "54", "38", "45", "41", "04", "49", "79", "48", "51", "05", "67", "59", "23", "78", "50", "29", "83", "89", "72", "86", "77", "57", "46", "63", "47", "37", "65", "22", "69", "10"};

            for (int i = 0; i < array.length; i++) {
                String newBodyJson = boxyJson.replace("24", array[i]);

                int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                        .body(newBodyJson)
                        .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                        .then().log().body().extract().statusCode();
                Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> waitForBidResponse == 200);


            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    public void getMapSiderSub() {

        try {
            this.accessToken = new PostOAuth().main();
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String boxyJson = "{\"query\":\"query mapDistricts {\\n  districts(regionCode: 24) {\\n    id\\n    name\\n    __typename\\n  }\\n}\\n\",\"operationName\":\"mapDistricts\"}";
            String[] array = new String[]{"17", "56", "34", "31", "64", "36", "87", "03", "43", "16", "73", "70", "66", "02", "11", "14", "91", "92", "06", "20", "91", "25", "19", "01", "24", "26", "39", "12", "07", "09", "18", "27", "53", "44", "08", "61", "35", "30", "15", "71", "40", "76", "21", "74", "33", "13", "55", "68", "58", "52", "62", "32", "60", "42", "75", "28", "54", "38", "45", "41", "04", "49", "79", "48", "51", "05", "67", "59", "23", "78", "50", "29", "83", "89", "72", "86", "77", "57", "46", "63", "47", "37", "65", "22", "69", "10"};

            for (int i = 0; i < array.length; i++) {
                String newBodyJson = boxyJson.replace("24", array[i]);

                int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                        .body(newBodyJson)
                        .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                        .then().log().body().extract().statusCode();
                Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> waitForBidResponse == 200);


            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    public void mapSidebarSchools() {

        try {
            this.accessToken = new PostOAuth().main();
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String boxyJson = "{\"query\":\"query mapSidebarSchools {\\n  schools(regionCodes: \\\"01\\\") {\\n    id\\n    name\\n    geometry\\n    districtId\\n    rating\\n    countStudents\\n    regionCode\\n    __typename\\n  }\\n}\\n\",\"operationName\":\"mapSidebarSchools\"}";
            String[] array = new String[]{"17", "56", "34", "31", "64", "36", "87", "03", "43", "16", "73", "70", "66", "02", "11", "14", "91", "92", "06", "20", "91", "25", "19", "01", "24", "26", "39", "12", "07", "09", "18", "27", "53", "44", "08", "61", "35", "30", "15", "71", "40", "76", "21", "74", "33", "13", "55", "68", "58", "52", "62", "32", "60", "42", "75", "28", "54", "38", "45", "41", "04", "49", "79", "48", "51", "05", "67", "59", "23", "78", "50", "29", "83", "89", "72", "86", "77", "57", "46", "63", "47", "37", "65", "22", "69", "10"};

            for (int i = 0; i < array.length; i++) {
                String newBodyJson = boxyJson.replace("01", array[i]);

                int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                        .body(newBodyJson)
                        .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                        .then().log().body().extract().statusCode();
                Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> waitForBidResponse == 200);


            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

Сама структура проекта

Сам код компилируется и работает в Intellij Idea, но задача состоит в том, что необходимо запустить данный код на виртуальной машине из командной строки, но если я пытаюсь преобразовать JAVA файлы с помощью JAVAC , то получаю следующие ошибки

antana@ubuntu20:~/Cache/cism_testing/src/main/java/Oauth$ javac -d . *.java
Cache.java:4: error: package io.restassured.http does not exist
import io.restassured.http.ContentType;
                          ^
Cache.java:5: error: package org.awaitility does not exist
import org.awaitility.Awaitility;
                     ^
Cache.java:6: error: package org.junit does not exist
import org.junit.Test;
                ^
Cache.java:10: error: package constants.Constants.ServerConst does not exist
import static constants.Constants.ServerConst.Endpoint.COSIAL_PLACE_ENDPOINT_SEARCH;
                                             ^
Cache.java:10: error: static import only from classes and interfaces
import static constants.Constants.ServerConst.Endpoint.COSIAL_PLACE_ENDPOINT_SEARCH;
^
Cache.java:11: error: package constants.Constants.ServerConst does not exist
import static constants.Constants.ServerConst.Path.COSIAL_PLACE_PATH;
                                             ^
Cache.java:11: error: static import only from classes and interfaces
import static constants.Constants.ServerConst.Path.COSIAL_PLACE_PATH;
^
Cache.java:12: error: package constants.Constants does not exist
import static constants.Constants.ServerName.SOCIAL_PLACE_SERVER;
                                 ^
Cache.java:12: error: static import only from classes and interfaces
import static constants.Constants.ServerName.SOCIAL_PLACE_SERVER;
^
Cache.java:13: error: package io.restassured does not exist
import static io.restassured.RestAssured.given;
                            ^
Cache.java:13: error: static import only from classes and interfaces
import static io.restassured.RestAssured.given;
^
PostOAuth.java:3: error: package org.json does not exist
import org.json.JSONException;
               ^
PostOAuth.java:4: error: package org.json does not exist
import org.json.JSONObject;
               ^
PostOAuth.java:13: error: cannot find symbol
    public static String main() throws IOException, JSONException {
                                                    ^
  symbol:   class JSONException
  location: class PostOAuth
Cache.java:25: error: cannot find symbol
    @Test
     ^
  symbol:   class Test
  location: class Cache
Cache.java:59: error: cannot find symbol
    @Test
     ^
  symbol:   class Test
  location: class Cache
Cache.java:86: error: cannot find symbol
    @Test
     ^
  symbol:   class Test
  location: class Cache
Cache.java:113: error: cannot find symbol
    @Test
     ^
  symbol:   class Test
  location: class Cache
Cache.java:42: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                 ^
  symbol:   variable SOCIAL_PLACE_SERVER
  location: class Cache
Cache.java:42: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                                       ^
  symbol:   variable COSIAL_PLACE_PATH
  location: class Cache
Cache.java:42: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                                                           ^
  symbol:   variable COSIAL_PLACE_ENDPOINT_SEARCH
  location: class Cache
Cache.java:40: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                                                                  ^
  symbol:   variable ContentType
  location: class Cache
Cache.java:40: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                                         ^
  symbol:   variable ContentType
  location: class Cache
Cache.java:40: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                     ^
  symbol:   method given()
  location: class Cache
Cache.java:45: error: cannot find symbol
            Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> waitForBidResponse == 200);
            ^
  symbol:   variable Awaitility
  location: class Cache
Cache.java:76: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                 ^
  symbol:   variable SOCIAL_PLACE_SERVER
  location: class Cache
Cache.java:76: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                                       ^
  symbol:   variable COSIAL_PLACE_PATH
  location: class Cache
Cache.java:76: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                                                           ^
  symbol:   variable COSIAL_PLACE_ENDPOINT_SEARCH
  location: class Cache
Cache.java:74: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                                                                  ^
  symbol:   variable ContentType
  location: class Cache
Cache.java:74: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                                         ^
  symbol:   variable ContentType
  location: class Cache
Cache.java:74: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                     ^
  symbol:   method given()
  location: class Cache
Cache.java:78: error: cannot find symbol
            Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> waitForBidResponse == 200);
            ^
  symbol:   variable Awaitility
  location: class Cache
Cache.java:103: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                 ^
  symbol:   variable SOCIAL_PLACE_SERVER
  location: class Cache
Cache.java:103: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                                       ^
  symbol:   variable COSIAL_PLACE_PATH
  location: class Cache
Cache.java:103: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                                                           ^
  symbol:   variable COSIAL_PLACE_ENDPOINT_SEARCH
  location: class Cache
Cache.java:101: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                                                                  ^
  symbol:   variable ContentType
  location: class Cache
Cache.java:101: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                                         ^
  symbol:   variable ContentType
  location: class Cache
Cache.java:101: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                     ^
  symbol:   method given()
  location: class Cache
Cache.java:105: error: cannot find symbol
            Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> waitForBidResponse == 200);
            ^
  symbol:   variable Awaitility
  location: class Cache
Cache.java:130: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                 ^
  symbol:   variable SOCIAL_PLACE_SERVER
  location: class Cache
Cache.java:130: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                                       ^
  symbol:   variable COSIAL_PLACE_PATH
  location: class Cache
Cache.java:130: error: cannot find symbol
                    .when().post(SOCIAL_PLACE_SERVER + COSIAL_PLACE_PATH + COSIAL_PLACE_ENDPOINT_SEARCH)
                                                                           ^
  symbol:   variable COSIAL_PLACE_ENDPOINT_SEARCH
  location: class Cache
Cache.java:128: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                                                                  ^
  symbol:   variable ContentType
  location: class Cache
Cache.java:128: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                                         ^
  symbol:   variable ContentType
  location: class Cache
Cache.java:128: error: cannot find symbol
            int waitForBidResponse = given().contentType(ContentType.JSON).accept(ContentType.JSON).auth().oauth2(this.accessToken)
                                     ^
  symbol:   method given()
  location: class Cache
Cache.java:132: error: cannot find symbol
            Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> waitForBidResponse == 200);
            ^
  symbol:   variable Awaitility
  location: class Cache
PostOAuth.java:52: error: cannot find symbol
            JSONObject myObject = new JSONObject(response.toString());
            ^
  symbol:   class JSONObject
  location: class PostOAuth
PostOAuth.java:52: error: cannot find symbol
            JSONObject myObject = new JSONObject(response.toString());
                                      ^
  symbol:   class JSONObject
  location: class PostOAuth
48 errors

Подскажите, пожалуйста, в чем проблема данного кода и куда именно копать, пробовал указывать CLASSPATH на данные файлы, обернул всё в try/catch, также пробовал засунуть всё в 1 Java файл.

В проекте используется сборщик maven

версия maven и JDK

Билд maven

Билд maven


Ответы (0 шт):