org.apache.maven.model.Site Java Examples

The following examples show how to use org.apache.maven.model.Site. 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: MavenUtilTest.java    From jkube with Eclipse Public License 2.0 6 votes vote down vote up
private MavenProject getMavenProject() {
    MavenProject mavenProject = new MavenProject();
    mavenProject.setName("testProject");
    mavenProject.setGroupId("org.eclipse.jkube");
    mavenProject.setArtifactId("test-project");
    mavenProject.setVersion("0.1.0");
    mavenProject.setDescription("test description");
    Build build = new Build();
    build.setOutputDirectory("./target");
    build.setDirectory(".");
    mavenProject.setBuild(build);
    DistributionManagement distributionManagement = new DistributionManagement();
    Site site = new Site();
    site.setUrl("https://www.eclipse.org/jkube/");
    distributionManagement.setSite(site);
    mavenProject.setDistributionManagement(distributionManagement);
    return mavenProject;
}
 
Example #2
Source File: LocationAwareMavenXpp3Writer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void writeSite(Site site, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if (site.getId() != null) {
        writeValue(serializer, "id", site.getId(), site);
    }
    if (site.getName() != null) {
        writeValue(serializer, "name", site.getName(), site);
    }
    if (site.getUrl() != null) {
        writeValue(serializer, "url", site.getUrl(), site);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(site, "", start, b.length());
}
 
Example #3
Source File: MavenUtil.java    From jkube with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Retrieves the URL used for documentation from the provided {@link MavenProject}.
 *
 * @param project MavenProject from which to retrieve the documentation URL
 * @return the documentation URL
 */
public static String getDocumentationUrl(MavenProject project) {
    while (project != null) {
        DistributionManagement distributionManagement = project.getDistributionManagement();
        if (distributionManagement != null) {
            Site site = distributionManagement.getSite();
            if (site != null) {
                return site.getUrl();
            }
        }
        project = project.getParent();
    }
    return null;
}
 
Example #4
Source File: LocationAwareMavenXpp3Writer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void writeDistributionManagement(DistributionManagement distributionManagement, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();

    if (distributionManagement.getRepository() != null) {
        writeDeploymentRepository((DeploymentRepository) distributionManagement.getRepository(), "repository", serializer);
    }
    if (distributionManagement.getSnapshotRepository() != null) {
        writeDeploymentRepository((DeploymentRepository) distributionManagement.getSnapshotRepository(), "snapshotRepository", serializer);
    }
    if (distributionManagement.getSite() != null) {
        writeSite((Site) distributionManagement.getSite(), "site", serializer);
    }
    if (distributionManagement.getDownloadUrl() != null) {
        writeValue(serializer, "downloadUrl", distributionManagement.getDownloadUrl(), distributionManagement);
    }
    if (distributionManagement.getRelocation() != null) {
        writeRelocation((Relocation) distributionManagement.getRelocation(), "relocation", serializer);
    }
    if (distributionManagement.getStatus() != null) {
        writeValue(serializer, "status", distributionManagement.getStatus(), distributionManagement);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(distributionManagement, "", start, b.length());
}