Hadoopのような大きなプロジェクトのソースコードを解析するときに、同じクラス名と同じパッケージディレクトリを持つJavaクラスが存在する可能性があるため、「xxx型は既に定義されています」という問題が頻繁に発生しますサブプロジェクト。大きなプロジェクトのソースコードのスプーンのソースコード分析で "xxx型は既に定義されています"とどう対処しますか?
"java -cp xx spoon.Launcher -i〜/ hadoop-0.23.3-src/-p myspoon.CatchProcessor"を実行すると、次のエラーが発生します。
Exception in thread "main" spoon.compiler.ModelBuildingException: The type JobInProgress is already defined
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.reportProblem(JDTBasedSpoonCompiler.java:550)
at spoon.support.compiler.jdt.TreeBuilderRequestor.acceptResult(TreeBuilderRequestor.java:37)
at spoon.support.compiler.jdt.TreeBuilderCompiler.buildUnits(TreeBuilderCompiler.java:73)
at spoon.support.compiler.jdt.JDTBatchCompiler.getUnits(JDTBatchCompiler.java:120)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnits(JDTBasedSpoonCompiler.java:410)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnitsAndModel(JDTBasedSpoonCompiler.java:372)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildSources(JDTBasedSpoonCompiler.java:348)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:119)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:102)
at spoon.Launcher.buildModel(Launcher.java:700)
at spoon.Launcher.run(Launcher.java:651)
at spoon.Launcher.run(Launcher.java:106)
at spoon.Launcher.main(Launcher.java:99)
そして、私は2 JobInProgress.javaが同じサブプロジェクト "HadoopのMapReduceの-プロジェクト" である見つける
./hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobInProgress.java
./hadoop-mapreduce-project/src/java/org/apache/hadoop/mapred/JobInProgress.java
だから、どのようにこの問題を解決するには????? は、私はすでに「見つからないファイル」問題の
Exception in thread "main" spoon.compiler.ModelBuildingException: The import org.apache.hadoop.conf cannot be resolved at xxx
任意のコメントの別の問題が発生しますので、我々は、スプーンの分析を実行するために離れて、両方のいずれかを移動することができなかったようだことがわかりましたか?ありがとう。
ありがとうございました。これは良い提案です。私は試してみる。 –