本文整理汇总了Java中org.apache.maven.model.Scm类的典型用法代码示例。如果您正苦于以下问题:Java Scm类的具体用法?Java Scm怎么用?Java Scm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scm类属于org.apache.maven.model包,在下文中一共展示了Scm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: getScm
import org.apache.maven.model.Scm; //导入依赖的package包/类
private Scm getScm() {
Iterator<? extends MavenProject> prj = result.allInstances().iterator();
if (!prj.hasNext()) {
return null;
}
MavenProject project = prj.next();
return project.getScm();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CheckoutAction.java
示例17: getOrFindGitUrl
import org.apache.maven.model.Scm; //导入依赖的package包/类
protected String getOrFindGitUrl(UIExecutionContext context, String gitUrlText) {
if (Strings.isNullOrBlank(gitUrlText)) {
final Project project = getSelectedProject(context);
if (project != null) {
Resource<?> root = project.getRoot();
if (root != null) {
try {
Resource<?> gitFolder = root.getChild(".git");
if (gitFolder != null) {
Resource<?> config = gitFolder.getChild("config");
if (config != null) {
String configText = config.getContents();
gitUrlText = GitHelpers.extractGitUrl(configText);
}
}
} catch (Exception e) {
log.debug("Ignoring missing git folders: " + e, e);
}
}
}
}
if (Strings.isNullOrBlank(gitUrlText)) {
Model mavenModel = getMavenModel(context);
if (mavenModel != null) {
Scm scm = mavenModel.getScm();
if (scm != null) {
String connection = scm.getConnection();
if (Strings.isNotBlank(connection)) {
gitUrlText = connection;
}
}
}
}
if (Strings.isNullOrBlank(gitUrlText)) {
throw new IllegalArgumentException("Could not find git URL");
}
return gitUrlText;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:39,代码来源:AbstractDevOpsCommand.java
示例18: convertScm
import org.apache.maven.model.Scm; //导入依赖的package包/类
private org.apache.archiva.metadata.model.Scm convertScm( Scm scm )
{
org.apache.archiva.metadata.model.Scm newScm = null;
if ( scm != null )
{
newScm = new org.apache.archiva.metadata.model.Scm();
newScm.setConnection( scm.getConnection() );
newScm.setDeveloperConnection( scm.getDeveloperConnection() );
newScm.setUrl( scm.getUrl() );
}
return newScm;
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:13,代码来源:Maven2RepositoryStorage.java
示例19: revertScmSettings
import org.apache.maven.model.Scm; //导入依赖的package包/类
public void revertScmSettings(MavenProject projectToRevert, Document document) {
Scm scm = this.metadata.getCachedScmSettings(projectToRevert);
if (scm != null) {
this.log.debug("\t\tReversion of SCM connection tags");
Document originalPOM = this.metadata.getCachedOriginalPOM(projectToRevert);
Node scmNode = PomUtil.getOrCreateScmNode(document, false);
Node originalScmNode = PomUtil.getOrCreateScmNode(originalPOM, false);
if (scmNode != null) {
Optional<String> connection = PomUtil.getChildNodeTextContent(originalScmNode,
PomUtil.NODE_NAME_SCM_CONNECTION);
if (connection.isPresent()) {
PomUtil.setNodeTextContent(scmNode, PomUtil.NODE_NAME_SCM_CONNECTION, connection.get(), false);
}
Optional<String> devConnection = PomUtil.getChildNodeTextContent(originalScmNode,
PomUtil.NODE_NAME_SCM_DEV_CONNECTION);
if (devConnection.isPresent()) {
PomUtil.setNodeTextContent(scmNode, PomUtil.NODE_NAME_SCM_DEV_CONNECTION, devConnection.get(), false);
}
Optional<String> url = PomUtil.getChildNodeTextContent(originalScmNode, PomUtil.NODE_NAME_SCM_URL);
if (url.isPresent()) {
PomUtil.setNodeTextContent(scmNode, PomUtil.NODE_NAME_SCM_URL, url.get(), false);
}
if (scm.getTag() != null) {
PomUtil.setNodeTextContent(scmNode, PomUtil.NODE_NAME_SCM_TAG, scm.getTag(), false);
} else {
PomUtil.deleteNode(scmNode, PomUtil.NODE_NAME_SCM_TAG);
}
}
}
}
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:36,代码来源:DevVersionUtil.java
示例20: calcProviderName
import org.apache.maven.model.Scm; //导入依赖的package包/类
/**
* Derives the name of the required SCM provider from the given Maven project by analyzing the scm connection strings
* of the project.
*
* @param project the project from which the SCM provider is retrieved.
* @return the name of the required SCM provider.
*/
public static Optional<String> calcProviderName(MavenProject project) {
String providerName = null;
Scm scm = project.getScm();
if (scm != null) {
// takes the developer connection first or the connection url if devConnection is empty or null
String connection = StringUtils.trimToNull(scm.getDeveloperConnection());
connection = connection != null ? connection : StringUtils.trimToNull(scm.getConnection());
// scm url format description: https://maven.apache.org/scm/scm-url-format.html
if (connection != null) {
// cuts the substring "scm:" at the beginning
connection = connection.substring(4);
// as stated in the scm url format description, the provider delimiter may be a colon (:) or a pipe (|) if
// colons are used otherwise (e.g. for windows paths)
// svn:http://... -> svn:http://...
// svn|http://... -> svn
// svn:http://xyz|... -> svn:http://xyz
int nextPipe = connection.indexOf('|');
if (nextPipe > -1) {
connection = connection.substring(0, nextPipe);
}
// svn -> svn
// svn:http... -> svn
int nextColon = connection.indexOf(':');
if (nextColon > -1) {
providerName = connection.substring(0, nextColon);
} else {
providerName = connection;
}
}
}
return Optional.fromNullable(providerName);
}
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:46,代码来源:MavenScmUtil.java
注:本文中的org.apache.maven.model.Scm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论