Java Code Examples for org.apache.maven.project.MavenProject#getMailingLists()
The following examples show how to use
org.apache.maven.project.MavenProject#getMailingLists() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MavenHelper.java From cyclonedx-gradle-plugin with Apache License 2.0 | 4 votes |
/** * Extracts data from a project and adds the data to the component. * @param project the project to extract data from * @param component the component to add data to */ private void extractMetadata(MavenProject project, Component component) { if (component.getPublisher() == null) { // If we don't already have publisher information, retrieve it. if (project.getOrganization() != null) { component.setPublisher(project.getOrganization().getName()); } } if (component.getDescription() == null) { // If we don't already have description information, retrieve it. component.setDescription(project.getDescription()); } if (component.getLicenseChoice() == null || component.getLicenseChoice().getLicenses() == null || component.getLicenseChoice().getLicenses().isEmpty()) { // If we don't already have license information, retrieve it. if (project.getLicenses() != null) { component.setLicenseChoice(resolveMavenLicenses(project.getLicenses())); } } if (CycloneDxSchema.Version.VERSION_10 != schemaVersion) { if (project.getOrganization() != null && project.getOrganization().getUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.WEBSITE)) { addExternalReference(ExternalReference.Type.WEBSITE, project.getOrganization().getUrl(), component); } } if (project.getCiManagement() != null && project.getCiManagement().getUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.BUILD_SYSTEM)) { addExternalReference(ExternalReference.Type.BUILD_SYSTEM, project.getCiManagement().getUrl(), component); } } if (project.getDistributionManagement() != null && project.getDistributionManagement().getDownloadUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.DISTRIBUTION)) { addExternalReference(ExternalReference.Type.DISTRIBUTION, project.getDistributionManagement().getDownloadUrl(), component); } } if (project.getDistributionManagement() != null && project.getDistributionManagement().getRepository() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.DISTRIBUTION)) { addExternalReference(ExternalReference.Type.DISTRIBUTION, project.getDistributionManagement().getRepository().getUrl(), component); } } if (project.getIssueManagement() != null && project.getIssueManagement().getUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.ISSUE_TRACKER)) { addExternalReference(ExternalReference.Type.ISSUE_TRACKER, project.getIssueManagement().getUrl(), component); } } if (project.getMailingLists() != null && project.getMailingLists().size() > 0) { for (MailingList list : project.getMailingLists()) { if (list.getArchive() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.MAILING_LIST)) { addExternalReference(ExternalReference.Type.MAILING_LIST, list.getArchive(), component); } } else if (list.getSubscribe() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.MAILING_LIST)) { addExternalReference(ExternalReference.Type.MAILING_LIST, list.getSubscribe(), component); } } } } if (project.getScm() != null && project.getScm().getUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.VCS)) { addExternalReference(ExternalReference.Type.VCS, project.getScm().getUrl(), component); } } } }
Example 2
Source File: BaseCycloneDxMojo.java From cyclonedx-maven-plugin with Apache License 2.0 | 4 votes |
/** * Extracts data from a project and adds the data to the component. * @param project the project to extract data from * @param component the component to add data to */ private void extractMetadata(MavenProject project, Component component) { if (component.getPublisher() == null) { // If we don't already have publisher information, retrieve it. if (project.getOrganization() != null) { component.setPublisher(project.getOrganization().getName()); } } if (component.getDescription() == null) { // If we don't already have description information, retrieve it. component.setDescription(project.getDescription()); } if (component.getLicenseChoice() == null || component.getLicenseChoice().getLicenses() == null || component.getLicenseChoice().getLicenses().isEmpty()) { // If we don't already have license information, retrieve it. if (project.getLicenses() != null) { component.setLicenseChoice(resolveMavenLicenses(project.getLicenses())); } } if (CycloneDxSchema.Version.VERSION_10 != schemaVersion()) { if (project.getOrganization() != null && project.getOrganization().getUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.WEBSITE)) { addExternalReference(ExternalReference.Type.WEBSITE, project.getOrganization().getUrl(), component); } } if (project.getCiManagement() != null && project.getCiManagement().getUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.BUILD_SYSTEM)) { addExternalReference(ExternalReference.Type.BUILD_SYSTEM, project.getCiManagement().getUrl(), component); } } if (project.getDistributionManagement() != null && project.getDistributionManagement().getDownloadUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.DISTRIBUTION)) { addExternalReference(ExternalReference.Type.DISTRIBUTION, project.getDistributionManagement().getDownloadUrl(), component); } } if (project.getDistributionManagement() != null && project.getDistributionManagement().getRepository() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.DISTRIBUTION)) { addExternalReference(ExternalReference.Type.DISTRIBUTION, project.getDistributionManagement().getRepository().getUrl(), component); } } if (project.getIssueManagement() != null && project.getIssueManagement().getUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.ISSUE_TRACKER)) { addExternalReference(ExternalReference.Type.ISSUE_TRACKER, project.getIssueManagement().getUrl(), component); } } if (project.getMailingLists() != null && project.getMailingLists().size() > 0) { for (MailingList list : project.getMailingLists()) { if (list.getArchive() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.MAILING_LIST)) { addExternalReference(ExternalReference.Type.MAILING_LIST, list.getArchive(), component); } } else if (list.getSubscribe() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.MAILING_LIST)) { addExternalReference(ExternalReference.Type.MAILING_LIST, list.getSubscribe(), component); } } } } if (project.getScm() != null && project.getScm().getUrl() != null) { if (!doesComponentHaveExternalReference(component, ExternalReference.Type.VCS)) { addExternalReference(ExternalReference.Type.VCS, project.getScm().getUrl(), component); } } } }