{"record":{"id":"2af33c27f6e27ff1","repo":"OpenAPITools/openapi-generator","slug":"inputspec-inputspecrootdirectory-or-inputspecfil","errorCode":null,"errorMessage":"inputSpec, inputSpecRootDirectory, or inputSpecFiles must be specified","messagePattern":"inputSpec, inputSpecRootDirectory, or inputSpecFiles must be specified","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java","lineNumber":621,"sourceCode":"     * Maven ProjectHelper used to manage build artifacts.\n     */\n    @Component\n    MavenProjectHelper mavenProjectHelper;\n\n    @Parameter(defaultValue = \"${mojoExecution}\", readonly = true)\n    private MojoExecution mojo;\n\n    /**\n     * The project being built.\n     */\n    @Parameter(readonly = true, required = true, defaultValue = \"${project}\")\n    private MavenProject project;\n\n    @Override\n    public void execute() throws MojoExecutionException {\n        if (StringUtils.isBlank(inputSpec) && StringUtils.isBlank(inputSpecRootDirectory) && (inputSpecFiles == null || inputSpecFiles.isEmpty())) {\n            LOGGER.error(\"inputSpec, inputSpecRootDirectory, or inputSpecFiles must be specified\");\n            throw new MojoExecutionException(\"inputSpec, inputSpecRootDirectory, or inputSpecFiles must be specified\");\n        }\n\n        if (inputSpecFiles != null && !inputSpecFiles.isEmpty()) {\n            if (mergedFileOutputDir == null) {\n                throw new MojoExecutionException(\"mergedFileOutputDir must be set when inputSpecFiles is used\");\n            }\n            MergedSpecBuilder.MergeMode resolvedMergeMode;\n            try {\n                resolvedMergeMode = MergedSpecBuilder.MergeMode.valueOf(mergeMode.toUpperCase(Locale.ROOT));\n            } catch (IllegalArgumentException e) {\n                throw new MojoExecutionException(\"Invalid mergeMode value '\" + mergeMode\n                        + \"'. Valid values are: REF, DEEP\");\n            }\n\n            MergedSpecBuilder builder = new MergedSpecBuilder(inputSpecFiles, mergedFileOutputDir.getAbsolutePath(),\n                    mergedFileName, mergedFileInfoName, mergedFileInfoDescription, mergedFileInfoVersion, auth)\n                    .withMergeMode(resolvedMergeMode);\n","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java#L603-L639","documentation":"Thrown by the generate goal (CodeGenMojo.execute) of openapi-generator-maven-plugin when none of the three mutually alternative spec inputs is configured: inputSpec (single file/URL), inputSpecRootDirectory (directory scan), or inputSpecFiles (explicit list). It is the first guard in execute(), so the goal fails immediately with a MojoExecutionException before any spec parsing or generation.","triggerScenarios":"Running mvn openapi-generator:generate (or the goal bound in the POM) with a <configuration> block that omits all three properties, or CLI invocation without -DinputSpec=... . Also happens when the configuration sits on the wrong execution/goal, or property names are typo'd (<inputspec> instead of <inputSpec>), so Maven never binds the value.","commonSituations":"Copy-pasted plugin snippet from docs with the spec path placeholder never filled in; spec path moved/renamed but the property deleted instead of updated; CI pipeline where the -DinputSpec flag was dropped from the mvn command; multi-module POM where the configuration was added to pluginManagement instead of the actual plugin execution.","solutions":["Add <inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec> to the plugin <configuration> for the generate goal.","If you have many spec files in a tree, use <inputSpecRootDirectory> instead — the plugin merges them via MergedSpecBuilder.","For an explicit list, use <inputSpecFiles> together with <mergedFileOutputDir>.","Verify the property names and that the configuration is attached to the openapi-generator:generate goal execution, not only to pluginManagement; run mvn help:describe or -X to confirm bound values."],"exampleFix":"<!-- before -->\n<plugin>\n  <groupId>org.openapitools</groupId>\n  <artifactId>openapi-generator-maven-plugin</artifactId>\n  <executions><execution><goals><goal>generate</goal></goals></execution></executions>\n</plugin>\n\n<!-- after -->\n<plugin>\n  <groupId>org.openapitools</groupId>\n  <artifactId>openapi-generator-maven-plugin</artifactId>\n  <executions><execution><goals><goal>generate</goal></goals></execution></executions>\n  <configuration>\n    <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>\n    <generatorName>java</generatorName>\n  </configuration>\n</plugin>","handlingStrategy":"validation","validationCode":"<!-- fail the build early with a clear message instead of letting the mojo fail -->\n<plugin>\n  <groupId>org.apache.maven.plugins</groupId>\n  <artifactId>maven-enforcer-plugin</artifactId>\n  <executions><execution>\n    <id>check-spec-input</id>\n    <goals><goal>enforce</goal></goals>\n    <configuration><rules>\n      <requireProperty>\n        <property>openapi.spec.input</property>\n        <message>Set -Dopenapi.spec.input or configure inputSpec for openapi-generator:generate</message>\n      </requireProperty>\n    </rules></configuration>\n  </execution></executions>\n</plugin>","typeGuard":null,"tryCatchPattern":"# CI script: verify config before invoking the goal\nmvn -q help:evaluate -Dexpression=inputSpec -DforceStdout | grep -q . \\\n  || { echo 'inputSpec missing in openapi-generator config'; exit 1; }","preventionTips":["Keep a checked-in, fully populated <configuration> block for the generate goal; do not rely on CLI -D flags in CI.","Fail fast in CI with a lint step that greps the POM for inputSpec/inputSpecRootDirectory/inputSpecFiles on every openapi-generator execution.","Use ${project.basedir}-relative paths so the build works from any module directory.","After any POM refactor, run the goal once locally before pushing."],"tags":["openapi-generator","maven","plugin-config","missing-parameter","mojo-execution-exception"],"backgroundTag":"missing-required-config","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}