在 IntelliJ 中运行 Groovy 脚本失败

Woj*_*tek 5 groovy intellij-idea

我无法在 IntelliJ 中运行或调试 Groovy 脚本。我收到错误:Error: Could not find or load main class org.codehaus.groovy.tools.GroovyStarter。从 cmd 运行脚本可以正常工作(我正在使用 groovyc 和 groovy 命令)。

import org.apache.pdfbox.pdmodel.PDDocument
import org.fit.pdfdom.PDFDomTree
import org.w3c.dom.Document

// load the PDF file using PDFBox
PDDocument pdf = PDDocument.load(new java.io.File("file.pdf"))
// create the DOM parser
PDFDomTree parser = new PDFDomTree()
// parse the file and get the DOM Document
Document dom = parser.createDOM(pdf)
Run Code Online (Sandbox Code Playgroud)

Woj*_*tek 4

我在 pom.xml 文件中错过了https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all/2.4.12依赖项。错误已解决。谢谢大家的提示:)