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;
}
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();
}
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;
}
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));
}
}
}
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());
}
Aggregations