Search in sources :

Example 11 with Scm

use of org.apache.maven.model.Scm in project fabric8-maven-plugin by fabric8io.

the class MavenScmEnricher method getAnnotations.

private Map<String, String> getAnnotations() {
    Map<String, String> annotations = new HashMap<>();
    if (getContext() instanceof MavenEnricherContext) {
        MavenEnricherContext mavenEnricherContext = (MavenEnricherContext) getContext();
        MavenProject rootProject = mavenEnricherContext.getProject();
        if (hasScm(rootProject)) {
            Scm scm = rootProject.getScm();
            String url = scm.getUrl();
            String tag = scm.getTag();
            if (StringUtils.isNotEmpty(tag)) {
                annotations.put(Fabric8Annotations.SCM_TAG.value(), tag);
            }
            if (StringUtils.isNotEmpty(url)) {
                annotations.put(Fabric8Annotations.SCM_URL.value(), url);
            }
        }
    }
    return annotations;
}
Also used : MavenProject(org.apache.maven.project.MavenProject) HashMap(java.util.HashMap) Scm(org.apache.maven.model.Scm) MavenEnricherContext(io.fabric8.maven.enricher.api.MavenEnricherContext)

Example 12 with Scm

use of org.apache.maven.model.Scm in project maven-confluence-plugin by bsorrentino.

the class ScmRenderer method renderBody.

@Override
public void renderBody() {
    Scm scm = model.getScm();
    if (scm == null || StringUtils.isEmpty(anonymousConnection) && StringUtils.isEmpty(devConnection) && StringUtils.isEmpty(scm.getUrl())) {
        startSection(getTitle());
        paragraph(getI18nString("noscm"));
        endSection();
        return;
    }
    // fix issue #141
    startSection(getI18nString("title"));
    ScmRepository anonymousRepository = getScmRepository(anonymousConnection);
    ScmRepository devRepository = getScmRepository(devConnection);
    // Overview section
    renderOverviewSection(anonymousRepository, devRepository);
    // Web access section
    renderWebAccessSection(webAccessUrl);
    // Anonymous access section if needed
    renderAnonymousAccessSection(anonymousRepository);
    // Developer access section
    renderDeveloperAccessSection(devRepository);
    // Access from behind a firewall section if needed
    renderAccessBehindFirewallSection(devRepository);
    // Access through a proxy section if needed
    renderAccessThroughProxySection(anonymousRepository, devRepository);
    endSection();
}
Also used : ScmRepository(org.apache.maven.scm.repository.ScmRepository) Scm(org.apache.maven.model.Scm)

Example 13 with Scm

use of org.apache.maven.model.Scm in project tis by qlangtech.

the class AbstractTISManifestMojo method getScmUrl.

private String getScmUrl() {
    Scm scm = project.getScm();
    if (scm == null || StringUtils.isEmpty(scm.getUrl())) {
        MavenProject parent = project.getParent();
        scm = parent.getScm();
        if (scm != null && StringUtils.isNotBlank(scm.getUrl())) {
            boolean endWithSlash = StringUtils.endsWith(scm.getUrl(), "/");
            return scm.getUrl() + (endWithSlash ? StringUtils.EMPTY : "/") + project.getArtifactId();
        }
    } else {
        return scm.getUrl();
    }
    return null;
}
Also used : MavenProject(org.apache.maven.project.MavenProject) Scm(org.apache.maven.model.Scm)

Example 14 with Scm

use of org.apache.maven.model.Scm in project maven by apache.

the class DefaultModelInheritanceAssembler method assembleScmInheritance.

private void assembleScmInheritance(Model child, Model parent, String childPathAdjustment, boolean appendPaths) {
    if (parent.getScm() != null) {
        Scm parentScm = parent.getScm();
        Scm childScm = child.getScm();
        if (childScm == null) {
            childScm = new Scm();
            child.setScm(childScm);
        }
        if (StringUtils.isEmpty(childScm.getConnection()) && !StringUtils.isEmpty(parentScm.getConnection())) {
            childScm.setConnection(appendPath(parentScm.getConnection(), child.getArtifactId(), childPathAdjustment, appendPaths));
        }
        if (StringUtils.isEmpty(childScm.getDeveloperConnection()) && !StringUtils.isEmpty(parentScm.getDeveloperConnection())) {
            childScm.setDeveloperConnection(appendPath(parentScm.getDeveloperConnection(), child.getArtifactId(), childPathAdjustment, appendPaths));
        }
        if (StringUtils.isEmpty(childScm.getUrl()) && !StringUtils.isEmpty(parentScm.getUrl())) {
            childScm.setUrl(appendPath(parentScm.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths));
        }
    }
}
Also used : Scm(org.apache.maven.model.Scm)

Example 15 with Scm

use of org.apache.maven.model.Scm in project maven by apache.

the class AbstractModelInterpolatorTest method testShouldNotThrowExceptionOnReferenceToValueContainingNakedExpression.

@Test
public void testShouldNotThrowExceptionOnReferenceToValueContainingNakedExpression() throws Exception {
    Model model = new Model();
    Scm scm = new Scm();
    scm.setConnection("${test}/somepath");
    model.setScm(scm);
    model.addProperty("test", "test");
    ModelInterpolator interpolator = createInterpolator();
    final SimpleProblemCollector collector = new SimpleProblemCollector();
    Model out = interpolator.interpolateModel(model, new File("."), createModelBuildingRequest(context), collector);
    assertProblemFree(collector);
    assertEquals("test/somepath", out.getScm().getConnection());
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Model(org.apache.maven.model.Model) Scm(org.apache.maven.model.Scm) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

Scm (org.apache.maven.model.Scm)63 MavenProject (org.apache.maven.project.MavenProject)20 Model (org.apache.maven.model.Model)14 Test (org.junit.Test)10 File (java.io.File)6 IOException (java.io.IOException)6 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)4 DeploymentBuilder (io.fabric8.kubernetes.api.model.apps.DeploymentBuilder)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 Properties (java.util.Properties)4 Expectations (mockit.Expectations)4 ReleaseDescriptorBuilder (org.apache.maven.shared.release.config.ReleaseDescriptorBuilder)4 DefaultReleaseEnvironment (org.apache.maven.shared.release.env.DefaultReleaseEnvironment)4 ArrayList (java.util.ArrayList)3 Dependency (org.apache.maven.model.Dependency)3 IssueManagement (org.apache.maven.model.IssueManagement)3 License (org.apache.maven.model.License)3 ScmTranslator (org.apache.maven.shared.release.scm.ScmTranslator)3 HashSet (java.util.HashSet)2