Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add packageName configuration to maven #2429

Merged
merged 1 commit into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(name = "invokerPackage")
private String invokerPackage;

/**
* The default package to use for the generated objects
*/
@Parameter(name = "packageName")
private String packageName;

/**
* groupId in generated pom.xml
*/
Expand Down Expand Up @@ -510,6 +516,10 @@ public void execute() throws MojoExecutionException {
configurator.setInvokerPackage(invokerPackage);
}

if (isNotEmpty(packageName)) {
configurator.setPackageName(packageName);
}

if (isNotEmpty(groupId)) {
configurator.setGroupId(groupId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class CodegenConfigurator implements Serializable {
private String apiPackage;
private String modelPackage;
private String invokerPackage;
private String packageName;
private String modelNamePrefix;
private String modelNameSuffix;
private String groupId;
Expand Down Expand Up @@ -316,6 +317,15 @@ public CodegenConfigurator setInvokerPackage(String invokerPackage) {
return this;
}

public String getPackageName() {
return packageName;
}

public CodegenConfigurator setPackageName(String packageName) {
this.packageName = packageName;
return this;
}

public String getGroupId() {
return groupId;
}
Expand Down Expand Up @@ -521,6 +531,7 @@ public ClientOptInput toClientOptInput() {
checkAndSetAdditionalProperty(apiPackage, CodegenConstants.API_PACKAGE);
checkAndSetAdditionalProperty(modelPackage, CodegenConstants.MODEL_PACKAGE);
checkAndSetAdditionalProperty(invokerPackage, CodegenConstants.INVOKER_PACKAGE);
checkAndSetAdditionalProperty(packageName, CodegenConstants.PACKAGE_NAME);
checkAndSetAdditionalProperty(groupId, CodegenConstants.GROUP_ID);
checkAndSetAdditionalProperty(artifactId, CodegenConstants.ARTIFACT_ID);
checkAndSetAdditionalProperty(artifactVersion, CodegenConstants.ARTIFACT_VERSION);
Expand Down