Source:
public void execute() throws MojoExecutionException, MojoFailureException { if (keyStore.exists()) { if (overwriteKeyStore) { if (!keyStore.delete()) { throw new MojoFailureException("Unable to delete existing keystore at: " + keyStore); } } else { throw new MojoExecutionException("Keystore already exists (set 'overwriteKeyStore' to force) at: " + keyStore); } } checkKeystoreRequiredParameter(keyStoreAlias, "keyStoreAlias"); checkKeystoreRequiredParameter(keyStorePassword, "keyStorePassword"); if (keyPassword == null) { keyPassword = keyStorePassword; } StringBuilder distinguishedName = new StringBuilder(); Organization projectOrganization = project.getOrganization(); checkAndAddRequiredField(distinguishedName, "", "certDomain", certDomain, "cn=", () -> { if( projectOrganization != null && !StringUtils.isEmpty(projectOrganization.getUrl()) ){ String url = projectOrganization.getUrl(); if( url.startsWith("http://") ){ return url.substring("http://".length()); } if( url.startsWith("https://") ){ return url.substring("https://".length()); } } return null; }); checkAndAddRequiredField(distinguishedName, ",", "certOrgUnit", certOrgUnit, "ou=", () -> { return "none"; }); checkAndAddRequiredField(distinguishedName, ",", "certOrg", certOrg, "o=", () -> { if (projectOrganization != null && !StringUtils.isEmpty(projectOrganization.getName())) { return projectOrganization.getName(); } return null; }); checkAndAddRequiredField(distinguishedName, ",", "certState", certState, "st=", null); checkAndAddRequiredField(distinguishedName, ",", "certCountry", certCountry, "c=", null); generateKeyStore( keyStore, keyStoreAlias, keyStorePassword, keyPassword, distinguishedName.toString() ); }

Target:
public void execute() throws MojoExecutionException, MojoFailureException { if (keyStore.exists()) { if (overwriteKeyStore) { if (!keyStore.delete()) { throw new MojoFailureException("Unable to delete existing keystore at: " + keyStore); } } else { throw new MojoExecutionException("Keystore already exists (set 'overwriteKeyStore' to force) at: " + keyStore); } } checkKeystoreRequiredParameter(keyStoreAlias, "keyStoreAlias"); checkKeystoreRequiredParameter(keyStorePassword, "keyStorePassword"); if (keyPassword == null) { keyPassword = keyStorePassword; } List<String> distinguishedNameParts = new ArrayList<>(); Organization projectOrganization = project.getOrganization(); checkAndAddRequiredField(distinguishedNameParts, "certDomain", certDomain, "cn", () -> { if( projectOrganization != null && !StringUtils.isEmpty(projectOrganization.getUrl()) ){ String url = projectOrganization.getUrl(); if( url.startsWith("http://") ){ return url.substring("http://".length()); } if( url.startsWith("https://") ){ return url.substring("https://".length()); } } return null; }); checkAndAddRequiredField(distinguishedNameParts, "certOrgUnit", certOrgUnit, "ou", () -> { return "none"; }); checkAndAddRequiredField(distinguishedNameParts, "certOrg", certOrg, "o", () -> { if (projectOrganization != null && !StringUtils.isEmpty(projectOrganization.getName())) { return projectOrganization.getName(); } return null; }); checkAndAddRequiredField(distinguishedNameParts, "certState", certState, "st"); checkAndAddRequiredField(distinguishedNameParts, "certCountry", certCountry, "c"); generateKeyStore( keyStore, keyStoreAlias, keyStorePassword, keyPassword, String.join(", ", distinguishedNameParts) ); }