Skip to content

[Bug]: Attempting to build model of Dubbo (3.1.1) #4952

@QifanWang

Description

@QifanWang

Describe the bug

I try to analyze Dubbo source code, but Spoon throws a ModelBuildingException. Shall I use Spoon to analyze such multi-pom.xml projects? Or I need to set some properties of maven laucher?

Source code you are trying to analyze/transform

Source code are downloaded from https://github.com/apache/dubbo/archive/refs/tags/dubbo-3.1.1.zip

Source code for your Spoon processing

MavenLauncher launcher = new MavenLauncher(
               "/home/cstar/Downloads/dubbo-dubbo-3.1.1",
                MavenLauncher.SOURCE_TYPE.APP_SOURCE);
launcher.buildModel();

Actual output

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" spoon.compiler.ModelBuildingException: The type Application is already defined
	at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.reportProblem(JDTBasedSpoonCompiler.java:598)
	at spoon.support.compiler.jdt.TreeBuilderRequestor.acceptResult(TreeBuilderRequestor.java:29)
	at spoon.support.compiler.jdt.TreeBuilderCompiler.buildUnits(TreeBuilderCompiler.java:110)
	at spoon.support.compiler.jdt.JDTBatchCompiler.getUnits(JDTBatchCompiler.java:283)
	at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnits(JDTBasedSpoonCompiler.java:416)
	at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnitsAndModel(JDTBasedSpoonCompiler.java:368)
	at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildSources(JDTBasedSpoonCompiler.java:334)
	at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:115)
	at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:98)
	at spoon.Launcher.buildModel(Launcher.java:782)
	at Main.main(Main.java:9)

Process finished with exit code 1

Expected output

build model successfully.

Spoon Version

10.1.1

JVM Version

11

What operating system are you using?

Ubuntu 20.04.3 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions