【问题标题】:PDFBox import error in intellijIntellij中的PDFBox导入错误
【发布时间】:2016-09-03 17:56:38
【问题描述】:

PDFbox jar 已添加到 intellij(Setting> Project Structure> Modules> Dependencies) 中,并将 gradle 依赖项添加为 testCompile 'org.apache.pdfbox:pdfbox:2.0.1' 在 gradle build 中构建成功。即使在 java 文件中导入 'import org.pdfbox...' 后显示错误,因为无法解析符号 pdfbox。

还尝试了 File->Invalidate Caches\Restart。

【问题讨论】:

    标签: java intellij-idea pdfbox


    【解决方案1】:

    有时,您无需打开“项目结构”对话框即可创建库并将其添加到模块的依赖项中。当您的项目内容根目录中有 .jar 文件时就是这种情况。

    您可以在项目工具窗口中选择此类 .jar 文件并使用这些文件创建库。这样做时,您将能够选择库级别以及应将新库添加到其依赖项的模块。

    以类似的方式,您可以使用包含 .jar 文件的目录来创建库。

    Open the Project tool window (e.g. View | Tool Windows | Project).
    Select the .jar file or files to be included in the library, or a directory that contains the .jar files of interest.
    Select Add as Library from the context menu.
    In the Create Library dialog, specify the library name, level and the module in which this library will be used.
    

    这解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-18
      • 1970-01-01
      • 2019-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-02
      • 1970-01-01
      相关资源
      最近更新 更多