Merge pull request #4009 from wing328/change_source_folder

[Maven] Correct source folder for generated files
This commit is contained in:
wing328 2016-10-17 09:48:31 +08:00 committed by GitHub
commit 3362578595

View File

@ -16,11 +16,17 @@ package io.swagger.codegen.plugin;
* limitations under the License. * limitations under the License.
*/ */
import io.swagger.codegen.CliOption; import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyAdditionalPropertiesKvp;
import io.swagger.codegen.ClientOptInput; import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyImportMappingsKvp;
import io.swagger.codegen.CodegenConfig; import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyInstantiationTypesKvp;
import io.swagger.codegen.DefaultGenerator; import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsv;
import io.swagger.codegen.config.CodegenConfigurator; import static io.swagger.codegen.config.CodegenConfiguratorUtils.applyTypeMappingsKvp;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
@ -28,12 +34,12 @@ import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import java.io.File; import io.swagger.codegen.CliOption;
import java.util.HashMap; import io.swagger.codegen.ClientOptInput;
import java.util.Map; import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.CodegenConstants;
import static io.swagger.codegen.config.CodegenConfiguratorUtils.*; import io.swagger.codegen.DefaultGenerator;
import static org.apache.commons.lang3.StringUtils.isNotEmpty; import io.swagger.codegen.config.CodegenConfigurator;
/** /**
* Goal which generates client/server code from a swagger json/yaml definition. * Goal which generates client/server code from a swagger json/yaml definition.
@ -304,7 +310,8 @@ public class CodeGenMojo extends AbstractMojo {
} }
if (addCompileSourceRoot) { if (addCompileSourceRoot) {
project.addCompileSourceRoot(output.toString()); String sourceJavaFolder = output.toString() + "/" + configOptions.get(CodegenConstants.SOURCE_FOLDER);
project.addCompileSourceRoot(sourceJavaFolder);
} }
} }
} }