{"record":{"id":"4b10cd60cfd7ef37","repo":"quarkusio/quarkus","slug":"cannot-specify-both-class-and-method-name","errorCode":null,"errorMessage":"Cannot specify both class and method name","messagePattern":"Cannot specify both class and method name","errorType":"exception","errorClass":"MojoFailureException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/AnalyseCallTreeMojo.java","lineNumber":33,"sourceCode":" * -H:+PrintAnalysisCallTree,\n * and does a more meaningful analysis of what is causing a type to be retained.\n */\n@Mojo(name = \"analyze-call-tree\")\npublic class AnalyseCallTreeMojo extends AbstractMojo {\n\n    @Parameter(defaultValue = \"${class}\")\n    private String className;\n\n    @Parameter(defaultValue = \"${method}\")\n    private String methodName;\n\n    @Parameter(defaultValue = \"${project.build.directory}/reports\")\n    private File reportsDir;\n\n    @Override\n    public void execute() throws MojoExecutionException, MojoFailureException {\n        if (methodName != null && className != null) {\n            throw new MojoFailureException(\"Cannot specify both class and method name\");\n        }\n        String clazz = className;\n        String method = \"<init>\";\n        if (methodName != null) {\n            int index = methodName.lastIndexOf('.');\n            clazz = methodName.substring(0, index);\n            method = methodName.substring(index + 1);\n        }\n\n        File[] files = reportsDir.listFiles();\n        if (files == null) {\n            throw new MojoFailureException(\"No reports in \" + reportsDir);\n        }\n        for (File i : files) {\n            if (i.getName().startsWith(\"call_tree\")) {\n                try {\n                    System.out.println(new ReportAnalyzer(i.getAbsolutePath()).analyse(clazz, method));\n                } catch (Exception e) {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/AnalyseCallTreeMojo.java#L15-L51","documentation":"AnalyseCallTreeMojo.execute rejects a configuration where both `className` and `methodName` parameters are set, because the analysis target must be either a whole class or a single fully-qualified method, not both. Thrown as MojoFailureException before any report parsing.","triggerScenarios":"Running `mvn quarkus:analyze-call-tree` with both -DclassName and -DmethodName properties defined.","commonSituations":"CI property inheritance where one parameter is set in pom.xml and the other on the command line; copy-paste of example commands including both flags.","solutions":["Remove one of the two parameters: use -DmethodName=com.acme.MyClass.myMethod for a method, or -DclassName=com.acme.MyClass for the class.","Check pom.xml <configuration> for a lingering className/methodName setting."],"exampleFix":"// before\nmvn quarkus:analyze-call-tree -DclassName=com.acme.Foo -DmethodName=com.acme.Foo.run\n// after\nmvn quarkus:analyze-call-tree -DmethodName=com.acme.Foo.run","handlingStrategy":"validation","validationCode":"if ([project.hasProperty('className'), project.hasProperty('methodName')].count { it } > 1) throw new IllegalArgumentException('Set only one of className or methodName')","typeGuard":null,"tryCatchPattern":"try { ... } catch (MojoFailureException e) { log.error('Call-tree target misconfigured: ' + e.getMessage()); }","preventionTips":["Choose one analysis target style and stick to it in CI.","Prefer the combined -DmethodName=fqcn.method form for single methods."],"tags":["maven","configuration","analysis"],"backgroundTag":"mutually-exclusive-parameters","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}