当前位置: 首页>>代码示例>>Java>>正文


Java Scm类代码示例

本文整理汇总了Java中org.apache.maven.model.Scm的典型用法代码示例。如果您正苦于以下问题:Java Scm类的具体用法?Java Scm怎么用?Java Scm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Scm类属于org.apache.maven.model包,在下文中一共展示了Scm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeScm

import org.apache.maven.model.Scm; //导入依赖的package包/类
private void writeScm(Scm scm, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if (scm.getConnection() != null) {
        writeValue(serializer, "connection", scm.getConnection(), scm);
    }
    if (scm.getDeveloperConnection() != null) {
        writeValue(serializer, "developerConnection", scm.getDeveloperConnection(), scm);
    }
    if ((scm.getTag() != null) && !scm.getTag().equals("HEAD")) {
        writeValue(serializer, "tag", scm.getTag(), scm);
    }
    if (scm.getUrl() != null) {
        writeValue(serializer, "url", scm.getUrl(), scm);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(scm, "", start, b.length());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:LocationAwareMavenXpp3Writer.java

示例2: updateScm

import org.apache.maven.model.Scm; //导入依赖的package包/类
/**
 * Method updateScm
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateScm( Scm value, String xmlTag, Counter counter, Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        //CHECKSTYLE_OFF: LineLength

        Counter innerCount = new Counter( counter.getDepth() + 1 );
        findAndReplaceSimpleElement( innerCount, root, "connection", value.getConnection(), null );
        findAndReplaceSimpleElement( innerCount, root, "developerConnection", value.getDeveloperConnection(), null );
        findAndReplaceSimpleElement( innerCount, root, "tag", value.getTag(), "HEAD" );
        findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );

        //CHECKSTYLE_ON: LineLength
    }
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:26,代码来源:MavenJDOMWriter.java

示例3: testCalcProviderName

import org.apache.maven.model.Scm; //导入依赖的package包/类
@Test
@UseDataProvider("calcProviderName")
public void testCalcProviderName(String devConnection, String connection, String expectedProviderName) {
  MavenProject p = new MavenProject();
  p.setScm(new Scm());
  p.getScm().setDeveloperConnection(devConnection);
  p.getScm().setConnection(connection);

  Optional<String> providerName = MavenScmUtil.calcProviderName(p);
  if (expectedProviderName == null) {
    Assert.assertFalse(providerName.isPresent());
  } else {
    Assert.assertTrue(providerName.isPresent());
    Assert.assertEquals(expectedProviderName, providerName.get());
  }
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:17,代码来源:MavenScmUtilTest.java

示例4: initialize

import org.apache.maven.model.Scm; //导入依赖的package包/类
@Override
public void initialize() throws PluginException {
	final Scm scm = getProject().getScm();
	if (scm != null) {
		remoteUrlOrNull = scm.getDeveloperConnection();
		if (remoteUrlOrNull == null) {
			remoteUrlOrNull = scm.getConnection();
		}
		if (remoteUrlOrNull != null) {
			if (!remoteUrlOrNull.startsWith(GIT_PREFIX)) {
				throw new PluginException(ERROR_SUMMARY).add("The value in your scm tag is %s", remoteUrlOrNull);
			}
			remoteUrlOrNull = remoteUrlOrNull.substring(GIT_PREFIX.length()).replace("file://localhost/",
					"file:///");
		}
	}
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:18,代码来源:DefaultRootProject.java

示例5: getRemoteUrlOrNullIfNoneSet

import org.apache.maven.model.Scm; //导入依赖的package包/类
protected static String getRemoteUrlOrNullIfNoneSet(Scm originalScm, Scm actualScm) throws ValidationException {
    if (originalScm == null) {
        // No scm was specified, so don't inherit from any parent poms as they are probably used in different git repos
        return null;
    }

    // There is an SCM specified, so the actual SCM with derived values is used in case (so that variables etc are interpolated)
    String remote = actualScm.getDeveloperConnection();
    if (remote == null) {
        remote = actualScm.getConnection();
    }
    if (remote == null) {
        return null;
    }
    return GitHelper.scmUrlToRemote(remote);
}
 
开发者ID:danielflower,项目名称:multi-module-maven-release-plugin,代码行数:17,代码来源:BaseMojo.java

示例6: update

import org.apache.maven.model.Scm; //导入依赖的package包/类
@Override
protected void update(ModifiedPomXMLEventReader pom) throws MojoExecutionException, MojoFailureException, XMLStreamException, ArtifactMetadataRetrievalException
{
    try
    {
        Model model = PomHelper.getRawModel( pom );
        Scm scm = model.getScm();
        if (scm == null)
        {
            throw new MojoFailureException( "No <scm> was present" );
        }
        getLog().info( "Updating from tag " + scm.getTag() + " > " + newTag );

        boolean success = PomHelper.setProjectValue(pom, "/project/scm/tag", newTag );
        if ( !success )
        {
            throw new MojoFailureException( "Could not update the SCM tag" );
        }
    }
    catch ( IOException e )
    {
        throw new MojoExecutionException( e.getMessage(), e );
    }
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:25,代码来源:SetScmTagMojo.java

示例7: getSourceCode

import org.apache.maven.model.Scm; //导入依赖的package包/类
/**
 * Lookup source code configuration or default to SCM.
 *
 * @param project project
 * @param log log
 * @return source code url or null
 */
protected static String getSourceCode(MavenProject project, Log log) {
    Plugin nbmPlugin = lookupNbmPlugin(project);
    if (nbmPlugin != null) {
        Xpp3Dom config = (Xpp3Dom) nbmPlugin.getConfiguration();
        if (config != null && config.getChild("sourceCodeUrl") != null) {
            return config.getChild("sourceCodeUrl").getValue();
        }
    }

    Scm scm = project.getScm();
    if (scm != null && scm.getUrl() != null && !scm.getUrl().isEmpty()) {
        log.debug("SCM configuration found, with url = '" + scm.getUrl() + "'");
        return scm.getUrl();
    } else {

    }
    return null;
}
 
开发者ID:gephi,项目名称:gephi-maven-plugin,代码行数:26,代码来源:MetadataUtils.java

示例8: getScmUrl

import org.apache.maven.model.Scm; //导入依赖的package包/类
/**
 * This method tries to retrieve SCM URL, if POM model for given dependency does not specify SCM URL and
 * parent model belongs to the same group, we'll try to fecth URL from the parent model
 * @param dependency dependency to retrieve SCM URL for
 * @return SCM URL or null
 * @throws IOException
 * @throws XmlPullParserException
 */
private static String getScmUrl(RawDependency dependency) throws IOException, XmlPullParserException {
    Model model = fetchModel(dependency);
    while (model != null) {
        Scm scm = model.getScm();
        if (scm != null) {
            return scm.getUrl();
        }

        Parent parent = model.getParent();
        if (parent == null) {
            return null;
        }
        if (!StringUtils.equals(parent.getGroupId(), dependency.groupID)) {
            return null;
        }
        dependency = new RawDependency(parent.getGroupId(),
                parent.getArtifactId(),
                parent.getVersion(), null, null);
        model = fetchModel(dependency);
    }
    return null;
}
 
开发者ID:sourcegraph,项目名称:srclib-java,代码行数:31,代码来源:Resolver.java

示例9: mergeScm_Url

import org.apache.maven.model.Scm; //导入依赖的package包/类
@Override
protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
{
    String src = source.getUrl();
    if ( src != null )
    {
        if ( sourceDominant )
        {
            target.setUrl( src );
            target.setLocation( "url", source.getLocation( "url" ) );
        }
        else if ( target.getUrl() == null )
        {
            target.setUrl( appendPath( src, context ) );
            target.setLocation( "url", source.getLocation( "url" ) );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:MavenModelMerger.java

示例10: mergeScm_Connection

import org.apache.maven.model.Scm; //导入依赖的package包/类
@Override
protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
{
    String src = source.getConnection();
    if ( src != null )
    {
        if ( sourceDominant )
        {
            target.setConnection( src );
            target.setLocation( "connection", source.getLocation( "connection" ) );
        }
        else if ( target.getConnection() == null )
        {
            target.setConnection( appendPath( src, context ) );
            target.setLocation( "connection", source.getLocation( "connection" ) );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:19,代码来源:MavenModelMerger.java

示例11: mergeScm_DeveloperConnection

import org.apache.maven.model.Scm; //导入依赖的package包/类
@Override
protected void mergeScm_DeveloperConnection( Scm target, Scm source, boolean sourceDominant,
                                             Map<Object, Object> context )
{
    String src = source.getDeveloperConnection();
    if ( src != null )
    {
        if ( sourceDominant )
        {
            target.setDeveloperConnection( src );
            target.setLocation( "developerConnection", source.getLocation( "developerConnection" ) );
        }
        else if ( target.getDeveloperConnection() == null )
        {
            target.setDeveloperConnection( appendPath( src, context ) );
            target.setLocation( "developerConnection", source.getLocation( "developerConnection" ) );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:20,代码来源:MavenModelMerger.java

示例12: testShouldNotThrowExceptionOnReferenceToNonExistentValue

import org.apache.maven.model.Scm; //导入依赖的package包/类
public void testShouldNotThrowExceptionOnReferenceToNonExistentValue()
    throws Exception
{
    Model model = new Model();

    Scm scm = new Scm();
    scm.setConnection( "${test}/somepath" );

    model.setScm( scm );

    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() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:20,代码来源:AbstractModelInterpolatorTest.java

示例13: testShouldThrowExceptionOnRecursiveScmConnectionReference

import org.apache.maven.model.Scm; //导入依赖的package包/类
public void testShouldThrowExceptionOnRecursiveScmConnectionReference()
    throws Exception
{
    Model model = new Model();

    Scm scm = new Scm();
    scm.setConnection( "${project.scm.connection}/somepath" );

    model.setScm( scm );

    try
    {
        ModelInterpolator interpolator = createInterpolator();

        final SimpleProblemCollector collector = new SimpleProblemCollector();
        interpolator.interpolateModel( model, null, createModelBuildingRequest( context ), collector );
        assertColllectorState(  0, 1, 0, collector );
    }
    catch ( Exception e )
    {

    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:24,代码来源:AbstractModelInterpolatorTest.java

示例14: ExtendedArtifact

import org.apache.maven.model.Scm; //导入依赖的package包/类
/** Constructor.
 * @param artifact the artifact.
 * @param name name of the artifact.
 * @param website website.
 * @param organization organization.
 * @param scmRevision url of the SCM.
 * @param scm SCM.
 * @param developers developers.
 * @param contributors constributors.
 * @param licenses licenses.
 */
public ExtendedArtifact(
		Artifact artifact, String name,
		String website, Organization organization,
		String scmRevision,
		Scm scm,
		List<? extends Developer> developers,
		List<? extends Contributor> contributors,
		List<? extends License> licenses) {
	this.original = artifact;
	this.artifactName = name;
	this.developers = developers;
	this.contributors = contributors;
	this.website = website;
	this.organization = organization;
	this.scm = scm;
	this.scmRevision = scmRevision;
	this.licenses = licenses;
}
 
开发者ID:gallandarakhneorg,项目名称:afc,代码行数:30,代码来源:ExtendedArtifact.java

示例15: shouldNotFindBestPracticesViolation

import org.apache.maven.model.Scm; //导入依赖的package包/类
@Test
public void shouldNotFindBestPracticesViolation() {
    License license = new License();
    license.setName("license-name");
    license.setUrl("license-url");

    Developer developer = new Developer();
    developer.setId("dev-id");
    developer.setName("dev-name");

    Scm scm = new Scm();
    scm.setUrl("scm-url");
    scm.setConnection("scm-connection");

    PomBuilder pomBuilder = pom();
    pomBuilder.model().setName("foo-name");
    pomBuilder.model().setDescription(""); // empty description is allowed, see WOLF-69
    pomBuilder.model().setUrl("foo-url");
    pomBuilder.model().addLicense(license);
    pomBuilder.model().addDeveloper(developer);
    pomBuilder.model().setScm(scm);
    pomBuilder.create(repoFooDir);

    validationExecutor.execute(ctx);
    assertSuccess();
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:27,代码来源:TestBestPracticesValidator.java


注:本文中的org.apache.maven.model.Scm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。