mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 00:21:19 +00:00
[java] Improve pom.xml to qualify for publishing to Maven central (#4616)
* [java] Attach Javadoc to artifact generation. * [java] Attach source to artifact generation. * [java] Add gpg signing to artifact publishing. * [java] Add artifact URL to pom.xml . * [java] Add artifact description to pom.xml . * [java] Add artifact URL and description params to Jax RSS. * [java] Add developer info to pom.xml . * [java] Parameterise SCM info in generated pom.xml . * [java] Move GPG signing to verify phase so that .asc files are uploaded during deploy phase. * [java] Change GPG signing to be an optional via Maven profile. Can't assume all users will perform a release/deploy from an environment with correct GPG key/pass. * update java petstore smaples * camelize tag name, remove invalid file * add back missing files for okhttp-gson * fix docstring in java feign client * fix docstring with various java api clients
This commit is contained in:
@@ -36,6 +36,33 @@ public class CodegenConstants {
|
||||
public static final String ARTIFACT_VERSION = "artifactVersion";
|
||||
public static final String ARTIFACT_VERSION_DESC = "artifact version in generated pom.xml";
|
||||
|
||||
public static final String ARTIFACT_URL = "artifactUrl";
|
||||
public static final String ARTIFACT_URL_DESC = "artifact URL in generated pom.xml";
|
||||
|
||||
public static final String ARTIFACT_DESCRIPTION = "artifactDescription";
|
||||
public static final String ARTIFACT_DESCRIPTION_DESC = "artifact description in generated pom.xml";
|
||||
|
||||
public static final String SCM_CONNECTION = "scmConnection";
|
||||
public static final String SCM_CONNECTION_DESC = "SCM connection in generated pom.xml";
|
||||
|
||||
public static final String SCM_DEVELOPER_CONNECTION = "scmDeveloperConnection";
|
||||
public static final String SCM_DEVELOPER_CONNECTION_DESC = "SCM developer connection in generated pom.xml";
|
||||
|
||||
public static final String SCM_URL = "scmUrl";
|
||||
public static final String SCM_URL_DESC = "SCM URL in generated pom.xml";
|
||||
|
||||
public static final String DEVELOPER_NAME = "developerName";
|
||||
public static final String DEVELOPER_NAME_DESC = "developer name in generated pom.xml";
|
||||
|
||||
public static final String DEVELOPER_EMAIL = "developerEmail";
|
||||
public static final String DEVELOPER_EMAIL_DESC = "developer email in generated pom.xml";
|
||||
|
||||
public static final String DEVELOPER_ORGANIZATION = "developerOrganization";
|
||||
public static final String DEVELOPER_ORGANIZATION_DESC = "developer organization in generated pom.xml";
|
||||
|
||||
public static final String DEVELOPER_ORGANIZATION_URL = "developerOrganizationUrl";
|
||||
public static final String DEVELOPER_ORGANIZATION_URL_DESC = "developer organization URL in generated pom.xml";
|
||||
|
||||
public static final String LICENSE_NAME = "licenseName";
|
||||
public static final String LICENSE_NAME_DESC = "The name of the license";
|
||||
|
||||
|
||||
@@ -52,6 +52,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
protected String groupId = "io.swagger";
|
||||
protected String artifactId = "swagger-java";
|
||||
protected String artifactVersion = "1.0.0";
|
||||
protected String artifactUrl = "https://github.com/swagger-api/swagger-codegen";
|
||||
protected String artifactDescription = "Swagger Java";
|
||||
protected String developerName = "Swagger";
|
||||
protected String developerEmail = "apiteam@swagger.io";
|
||||
protected String developerOrganization = "Swagger";
|
||||
protected String developerOrganizationUrl = "http://swagger.io";
|
||||
protected String scmConnection = "scm:git:git@github.com:swagger-api/swagger-codegen.git";
|
||||
protected String scmDeveloperConnection = "scm:git:git@github.com:swagger-api/swagger-codegen.git";
|
||||
protected String scmUrl = "https://github.com/swagger-api/swagger-codegen";
|
||||
protected String licenseName = "Unlicense";
|
||||
protected String licenseUrl = "http://unlicense.org";
|
||||
protected String projectFolder = "src" + File.separator + "main";
|
||||
@@ -119,6 +128,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_URL, CodegenConstants.ARTIFACT_URL_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_DESCRIPTION, CodegenConstants.ARTIFACT_DESCRIPTION_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.SCM_CONNECTION, CodegenConstants.SCM_CONNECTION_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.SCM_DEVELOPER_CONNECTION, CodegenConstants.SCM_DEVELOPER_CONNECTION_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.SCM_URL, CodegenConstants.SCM_URL_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_NAME, CodegenConstants.DEVELOPER_NAME_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_EMAIL, CodegenConstants.DEVELOPER_EMAIL_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION, CodegenConstants.DEVELOPER_ORGANIZATION_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.DEVELOPER_ORGANIZATION_URL, CodegenConstants.DEVELOPER_ORGANIZATION_URL_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.LICENSE_NAME, CodegenConstants.LICENSE_NAME_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.LICENSE_URL, CodegenConstants.LICENSE_URL_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC));
|
||||
@@ -191,6 +209,60 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_URL)) {
|
||||
this.setArtifactUrl((String) additionalProperties.get(CodegenConstants.ARTIFACT_URL));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_URL, artifactUrl);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_DESCRIPTION)) {
|
||||
this.setArtifactDescription((String) additionalProperties.get(CodegenConstants.ARTIFACT_DESCRIPTION));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_DESCRIPTION, artifactDescription);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SCM_CONNECTION)) {
|
||||
this.setScmConnection((String) additionalProperties.get(CodegenConstants.SCM_CONNECTION));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.SCM_CONNECTION, scmConnection);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SCM_DEVELOPER_CONNECTION)) {
|
||||
this.setScmDeveloperConnection((String) additionalProperties.get(CodegenConstants.SCM_DEVELOPER_CONNECTION));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.SCM_DEVELOPER_CONNECTION, scmDeveloperConnection);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SCM_URL)) {
|
||||
this.setScmUrl((String) additionalProperties.get(CodegenConstants.SCM_URL));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.SCM_URL, scmUrl);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_NAME)) {
|
||||
this.setDeveloperName((String) additionalProperties.get(CodegenConstants.DEVELOPER_NAME));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.DEVELOPER_NAME, developerName);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_EMAIL)) {
|
||||
this.setDeveloperEmail((String) additionalProperties.get(CodegenConstants.DEVELOPER_EMAIL));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.DEVELOPER_EMAIL, developerEmail);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_ORGANIZATION)) {
|
||||
this.setDeveloperOrganization((String) additionalProperties.get(CodegenConstants.DEVELOPER_ORGANIZATION));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.DEVELOPER_ORGANIZATION, developerOrganization);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.DEVELOPER_ORGANIZATION_URL)) {
|
||||
this.setDeveloperOrganizationUrl((String) additionalProperties.get(CodegenConstants.DEVELOPER_ORGANIZATION_URL));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.DEVELOPER_ORGANIZATION_URL, developerOrganizationUrl);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.LICENSE_NAME)) {
|
||||
this.setLicenseName((String) additionalProperties.get(CodegenConstants.LICENSE_NAME));
|
||||
} else {
|
||||
@@ -929,6 +1001,42 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.artifactVersion = artifactVersion;
|
||||
}
|
||||
|
||||
public void setArtifactUrl(String artifactUrl) {
|
||||
this.artifactUrl = artifactUrl;
|
||||
}
|
||||
|
||||
public void setArtifactDescription(String artifactDescription) {
|
||||
this.artifactDescription = artifactDescription;
|
||||
}
|
||||
|
||||
public void setScmConnection(String scmConnection) {
|
||||
this.scmConnection = scmConnection;
|
||||
}
|
||||
|
||||
public void setScmDeveloperConnection(String scmDeveloperConnection) {
|
||||
this.scmDeveloperConnection = scmDeveloperConnection;
|
||||
}
|
||||
|
||||
public void setScmUrl(String scmUrl) {
|
||||
this.scmUrl = scmUrl;
|
||||
}
|
||||
|
||||
public void setDeveloperName(String developerName) {
|
||||
this.developerName = developerName;
|
||||
}
|
||||
|
||||
public void setDeveloperEmail(String developerEmail) {
|
||||
this.developerEmail = developerEmail;
|
||||
}
|
||||
|
||||
public void setDeveloperOrganization(String developerOrganization) {
|
||||
this.developerOrganization = developerOrganization;
|
||||
}
|
||||
|
||||
public void setDeveloperOrganizationUrl(String developerOrganizationUrl) {
|
||||
this.developerOrganizationUrl = developerOrganizationUrl;
|
||||
}
|
||||
|
||||
public void setLicenseName(String licenseName) {
|
||||
this.licenseName = licenseName;
|
||||
}
|
||||
@@ -1021,4 +1129,9 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
additionalProperties.put(propertyKey, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sanitizeTag(String tag) {
|
||||
return camelize(sanitizeName(tag));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user