netbeans在使用gradle时无法导入包

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

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

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

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

  1. nicholas@mordor:~/NetBeansProjects/odoo_demo$
  2. nicholas@mordor:~/NetBeansProjects/odoo_demo$ gradle build
  3. > Task :app:compileJava FAILED
  4. /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
  5. Object result = client.execute(pMethodName, params);
  6. ^
  7. 1 error
  8. FAILURE: Build failed with an exception.
  9. * What went wrong:
  10. Execution failed for task ':app:compileJava'.
  11. > Compilation failed; see the compiler error output for details.
  12. * Try:
  13. 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.
  14. * Get more help at https://help.gradle.org
  15. Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
  16. Use '--warning-mode all' to show the individual deprecation warnings.
  17. See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
  18. BUILD FAILED in 1s
  19. 1 actionable task: 1 executed
  20. nicholas@mordor:~/NetBeansProjects/odoo_demo$

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

文件夹:

  1. nicholas@mordor:~/NetBeansProjects/odoo_demo$
  2. nicholas@mordor:~/NetBeansProjects/odoo_demo$ tree
  3. .
  4. ├── app
  5.    ├── build.gradle
  6.    └── src
  7.    ├── main
  8.       ├── java
  9.          └── odoo_demo
  10.          ├── App.java
  11.          └── Baidu.java
  12.       └── resources
  13.    └── test
  14.    ├── java
  15.       └── odoo_demo
  16.    └── resources
  17. ├── gradle
  18.    └── wrapper
  19.    ├── gradle-wrapper.jar
  20.    └── gradle-wrapper.properties
  21. ├── gradlew
  22. ├── gradlew.bat
  23. └── settings.gradle
  24. 12 directories, 8 files
  25. nicholas@mordor:~/NetBeansProjects/odoo_demo$
  26. nicholas@mordor:~/NetBeansProjects/odoo_demo$ cat app/build.gradle
  27. /*
  28. * This file was generated by the Gradle 'init' task.
  29. *
  30. * This generated file contains a sample Java application project to get you started.
  31. * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
  32. * User Manual available at https://docs.gradle.org/6.7/userguide/building_java_projects.html
  33. */
  34. plugins {
  35. // Apply the application plugin to add support for building a CLI application in Java.
  36. id 'application'
  37. }
  38. repositories {
  39. // Use JCenter for resolving dependencies.
  40. jcenter()
  41. }
  42. dependencies {
  43. // Use TestNG framework, also requires calling test.useTestNG() below
  44. testImplementation 'org.testng:testng:7.2.0'
  45. // https://mvnrepository.com/artifact/org.apache.xmlrpc/xmlrpc-client
  46. compile group: 'org.apache.xmlrpc', name: 'xmlrpc-client', version: '3.1.3'
  47. // This dependency is used by the application.
  48. implementation 'com.google.guava:guava:29.0-jre'
  49. }
  50. application {
  51. // Define the main class for the application.
  52. mainClass = 'odoo_demo.App'
  53. }
  54. tasks.named('test') {
  55. // Use TestNG for unit tests.
  56. useTestNG()
  57. }
  58. nicholas@mordor:~/NetBeansProjects/odoo_demo$

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

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

暂无答案!

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

相关问题