在有关JavaParser的另一个线程中,您写道:“它不应具有任何依赖关系”。但是JavaParser具有对特殊ParseException的依赖:

在JavaParser中,line 205: throw new ParseException(ioe.getMessage())



构造函数ParseException(String)未定义
-添加参数以匹配ParseException(String,int)
例如。 java.text.ParseException(和其他三个)还有一个int参数errorOffset。



line 125 (and 8 more lines): new InstanceJavaParser(reader1).parse...()



类型InstanceJavaParser中的方法parse()引用缺少的类型ParseException



我可以从哪里下载哪个jar来获得特殊的ParseException?

(编辑)

也许我应该提供更多细节而不适合评论:

在Windows 10中:安装了Maven,mkdir D:\ workspaces \ trunk \ JavaParser-from-Maven \

cmd
D:
cd D:\workspaces\trunk\JavaParser-from-Maven\
D:\workspaces\trunk\JavaParser-from-Maven>mvn archetype:generate -DgroupId=com.github.javaparser -DartifactId=javaparser-core -DinteractiveMode=false    =>
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.pom (4 KB at 35.4 KB/sec)
[...] and many more .pom files [...]
[INFO] Generating project in Batch mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.jar (5 KB at 38.5 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.pom (703 B at 5.5 KB/sec)
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: D:\workspaces\trunk\JavaParser-from-Maven
[INFO] Parameter: package, Value: com.github.javaparser
[INFO] Parameter: groupId, Value: com.github.javaparser
[INFO] Parameter: artifactId, Value: javaparser-core
[INFO] Parameter: packageName, Value: com.github.javaparser
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: D:\workspaces\trunk\JavaParser-from-Maven\javaparser-core
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS


[...] =>
D:\ workspaces \ trunk \ JavaParser-from-Maven \ javaparser-core \ pom.xml已创建

D:\ workspaces \ trunk \ JavaParser-from-Maven \ javaparser-core \ src \ main \ java \ com \ github \ javaparser \ App.java(1 KB)创建,并说“ Hello World”

=>已下载了许多.pom文件和App.java,但尚未有JavaParser文件=> acc。到“如何编译源代码”:

尝试使用版本参数:

D:\workspaces\trunk\JavaParser-from-Maven>mvn archetype:generate -DgroupId=com.github.javaparser -DartifactId=javaparser-core -Dversion=2.1.0 -DinteractiveMode=false    =>
[...]  Building Maven Stub Project (No POM) 1
[...] [INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>


=>已经下载了许多.pom文件和一个App.java,但还没有JavaParser文件

=>符合到“如何编译源代码”:

cd javaparser-core     // where the POM.xml resides
mvn clean install    =>
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-core/2.0.6/maven-core-2.0.6.jar (149 KB at 152.8 KB/sec)
[...] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ javaparser-core ---
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.9/maven-plugin-api-2.0.9.pom [...]
[...] [INFO] Changes detected - recompiling the module!
[...]  T E S T S
Running com.github.javaparser.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec


要生成其他源文件:

D:\workspaces\trunk\JavaParser-from-Maven\javaparser-core>mvn javacc:javacc    =>
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/javacc-maven-plugin/maven-metadata.xml [...]
[...] [INFO] Building javaparser-core 2.1.0 [...]
Downloaded: ... .pom files ...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.4/maven-plugin-api-2.0.4.jar
Downloaded: ... another 57 .jar files ...
[INFO] Skipping non-existing source directory: D:\workspaces\trunk\JavaParser-from-Maven\javaparser-core\src\main\javacc
[INFO] BUILD SUCCESS


为什么我只得到一个虚拟的App.java,而没有涉及JavaParser的内容?

.pom和.jar都放在哪里?

所有.pom和.jar有什么影响?

最佳答案

当您构建JavaParser项目时,将生成该文件。这就是为什么它不在存储库中,这就是为什么我们仍然可以具有零依赖性的原因。

如果问题是您的IDE找不到此文件,请使其指向包含生成的源的目标文件夹中的目录。

10-07 15:52