- 请参阅固定导入语句的链接问题。我将在从Netbeans尝试后更新此问题。*
在下面使用的Netbeans中,所有内容都是should build。然而,这个问题是针对Netbeans的。
- 查找Netbeans以添加必需的导入语句。*
缺少的特定导入:
https://fasterxml.github.io/jackson-core/javadoc/2.8/com/fasterxml/jackson/core/JsonFactory.html
代码:
package sheets;
public class App {
public String getGreeting() {
return "Hello World!";
}
private static final String APPLICATION_NAME = "Google Sheets API Java Quickstart";
private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
private static final String TOKENS_DIRECTORY_PATH = "tokens";
private static final List<String> SCOPES = Arrays.asList(SheetsScopes.SPREADSHEETS, SheetsScopes.DRIVE, SheetsScopes.DRIVE_FILE);
private static final String CREDENTIALS_FILE_PATH = "/credentials.json";
public static void main(String[] args) {
System.out.println(new App().getGreeting());
}
}
无法解析或找到所有导入:
上文中,发现了足够多的进口产品,表明应该有其他进口产品----* 但不是所有**。
构建文件:
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java application project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/8.1.1/userguide/building_java_projects.html
* This project uses @Incubating APIs which are subject to change.
*/
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
// This dependency is used by the application.
implementation 'com.google.guava:guava:31.1-jre'
// https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client
// implementation group: 'com.google.oauth-client', name: 'google-oauth-client', version: '1.34.1'
// https://mvnrepository.com/artifact/com.google.api-client/google-api-client
implementation group: 'com.google.api-client', name: 'google-api-client', version: '2.2.0'
// https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty
implementation group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.34.1'
// https://mvnrepository.com/artifact/com.google.apis/google-api-services-sheets
implementation group: 'com.google.apis', name: 'google-api-services-sheets', version: 'v4-rev612-1.25.0'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.2'
// https://mvnrepository.com/artifact/com.google.api-client/google-api-client-jackson2
implementation group: 'com.google.api-client', name: 'google-api-client-jackson2', version: '1.20.0'
}
testing {
suites {
// Configure the built-in test suite
test {
// Use TestNG test framework
useTestNG('7.5')
}
}
}
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(20)
}
}
application {
// Define the main class for the application.
mainClass = 'sheets.App'
}
此问题仅适用于NetBeans。
1条答案
按热度按时间fquxozlt1#
你有没有尝试过“重新加载项目”(在上下文菜单中)?