netbeans在使用gradle时无法导入包

dauxcl2d  于 2021-07-12  发布在  Java
关注(0)|答案(0)|浏览(172)

(此处为示例代码。)
问题不是:

error: unreported exception XmlRpcException; must be caught or declared to be thrown

以至于 IDE ,这里, Netbeans ,不需要扔掉这个包裹。我希望将来会有一个选择 IDE 那就是 Exception 必须抓住或扔掉上面的东西。
在gui中没有这样的消息 Netbeans .
为什么不?

nicholas@mordor:~/NetBeansProjects/odoo_demo$ 
nicholas@mordor:~/NetBeansProjects/odoo_demo$ gradle build

> Task :app:compileJava FAILED
/home/nicholas/NetBeansProjects/odoo_demo/app/src/main/java/odoo_demo/Baidu.java:20: error: unreported exception XmlRpcException; must be caught or declared to be thrown
        Object result = client.execute(pMethodName, params);
                                      ^
1 error

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.                                                                                                            

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
1 actionable task: 1 executed
nicholas@mordor:~/NetBeansProjects/odoo_demo$

再说一遍,只关心 IDE 没有发现需要抛出异常。

文件夹:

nicholas@mordor:~/NetBeansProjects/odoo_demo$ 
nicholas@mordor:~/NetBeansProjects/odoo_demo$ tree
.
├── app
│   ├── build.gradle
│   └── src
│       ├── main
│       │   ├── java
│       │   │   └── odoo_demo
│       │   │       ├── App.java
│       │   │       └── Baidu.java
│       │   └── resources
│       └── test
│           ├── java
│           │   └── odoo_demo
│           └── resources
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

12 directories, 8 files
nicholas@mordor:~/NetBeansProjects/odoo_demo$ 
nicholas@mordor:~/NetBeansProjects/odoo_demo$ cat app/build.gradle 
/*
 * 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/6.7/userguide/building_java_projects.html
 */

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'
}

repositories {
    // Use JCenter for resolving dependencies.
    jcenter()
}

dependencies {
    // Use TestNG framework, also requires calling test.useTestNG() below
    testImplementation 'org.testng:testng:7.2.0'

      // https://mvnrepository.com/artifact/org.apache.xmlrpc/xmlrpc-client
      compile group: 'org.apache.xmlrpc', name: 'xmlrpc-client', version: '3.1.3'

    // This dependency is used by the application.
    implementation 'com.google.guava:guava:29.0-jre'
}

application {
    // Define the main class for the application.
    mainClass = 'odoo_demo.App'
}

tasks.named('test') {
    // Use TestNG for unit tests.
    useTestNG()
}
nicholas@mordor:~/NetBeansProjects/odoo_demo$

进口货在grad尔。
项目属性:

我怎么才能得到 Netbeans 捡起 Apache 合适吗?
请注意,包的“自动导入”也不起作用。可能如果 Netbeans 如果进口所需的 Package ,另一个问题就会解决。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题