org.apache.maven.model.Parent.getGroupId()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.apache.maven.model.Parent.getGroupId()方法的一些代码示例,展示了Parent.getGroupId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parent.getGroupId()方法的具体详情如下:
包路径:org.apache.maven.model.Parent
类名称:Parent
方法名:getGroupId

Parent.getGroupId介绍

[英]Get the group id of the parent project to inherit from.
[中]获取要从中继承的父项目的组id。

代码示例

代码示例来源:origin: apache/maven

/**
 * @return the id as <code>groupId:artifactId:version</code>
 */
public String getId()
{
  StringBuilder id = new StringBuilder( 64 );
  id.append( getGroupId() );
  id.append( ":" );
  id.append( getArtifactId() );
  id.append( ":" );
  id.append( "pom" );
  id.append( ":" );
  id.append( getVersion() );
  return id.toString();
}

代码示例来源:origin: apache/maven

protected void mergeParent_GroupId( Parent target, Parent source, boolean sourceDominant,
                  Map<Object, Object> context )
{
  String src = source.getGroupId();
  if ( src != null )
  {
    if ( sourceDominant || target.getGroupId() == null )
    {
      target.setGroupId( src );
      target.setLocation( "groupId", source.getLocation( "groupId" ) );
    }
  }
}

代码示例来源:origin: org.apache.maven/maven-project

public String getGroupId()
{
  String groupId = getModel().getGroupId();
  if ( ( groupId == null ) && ( getModel().getParent() != null ) )
  {
    groupId = getModel().getParent().getGroupId();
  }
  
  return groupId;
}

代码示例来源:origin: apache/maven

public String getGroupId()
{
  String groupId = getModel().getGroupId();
  if ( ( groupId == null ) && ( getModel().getParent() != null ) )
  {
    groupId = getModel().getParent().getGroupId();
  }
  return groupId;
}

代码示例来源:origin: apache/maven

addEdge( projectMap, vertexMap, null, projectVertex, parent.getGroupId(), parent.getArtifactId(),
     parent.getVersion(), true, false );

代码示例来源:origin: apache/maven

static String toId( Model model )
{
  if ( model == null )
  {
    return "";
  }
  String groupId = model.getGroupId();
  if ( groupId == null && model.getParent() != null )
  {
    groupId = model.getParent().getGroupId();
  }
  String artifactId = model.getArtifactId();
  String version = model.getVersion();
  if ( version == null )
  {
    version = "[unknown-version]";
  }
  return toId( groupId, artifactId, version );
}

代码示例来源:origin: org.apache.maven/maven-project

public static Parent cloneParent( Parent src )
{
  if ( src == null )
  {
    return null;
  }
  Parent result = new Parent();
  result.setArtifactId( src.getArtifactId() );
  result.setGroupId( src.getGroupId() );
  result.setRelativePath( src.getRelativePath() );
  result.setVersion( src.getVersion() );
  
  return result;
}

代码示例来源:origin: apache/maven

final Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom",
                        parent.getVersion() );
    String.format( "No versions matched the requested parent version range '%s'",
            parent.getVersion() ),
    parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
    String.format( "The requested parent version range '%s' does not specify an upper bound",
            parent.getVersion() ),
    parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
throw new UnresolvableModelException( e.getMessage(), parent.getGroupId(), parent.getArtifactId(),
                   parent.getVersion(), e );

代码示例来源:origin: apache/maven

final Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom",
                        parent.getVersion() );
    String.format( "No versions matched the requested parent version range '%s'",
            parent.getVersion() ),
    parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
    String.format( "The requested parent version range '%s' does not specify an upper bound",
            parent.getVersion() ),
    parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
throw new UnresolvableModelException( e.getMessage(), parent.getGroupId(), parent.getArtifactId(),
                   parent.getVersion(), e );

代码示例来源:origin: org.apache.maven/maven-project

if ( parent != null )
  if ( parent.getGroupId().equals( model.getGroupId() ) && 
      parent.getArtifactId().equals( model.getArtifactId() ) )

代码示例来源:origin: apache/maven

String groupId = parent.getGroupId();
String artifactId = parent.getArtifactId();
String version = parent.getVersion();
ModelData parentData = new ModelData( modelSource, parentModel, parent.getGroupId(), parent.getArtifactId(),
                   parent.getVersion() );

代码示例来源:origin: apache/maven

resolver.resolveRawModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
if ( groupId == null && candidateModel.getParent() != null )
  groupId = candidateModel.getParent().getGroupId();
if ( groupId == null || !groupId.equals( parent.getGroupId() ) || artifactId == null
  || !artifactId.equals( parent.getArtifactId() ) )
  buffer.append( " instead of " ).append( parent.getGroupId() ).append( ':' );
  buffer.append( parent.getArtifactId() ).append( ", please verify your project structure" );

代码示例来源:origin: apache/maven

/**
 * Method writeParent.
 * 
 * @param parent
 * @param serializer
 * @param tagName
 * @throws java.io.IOException
 */
private void writeParent( Parent parent, String tagName, XmlSerializer serializer )
  throws java.io.IOException
{
  serializer.startTag( NAMESPACE, tagName );
  if ( parent.getGroupId() != null )
  {
    serializer.startTag( NAMESPACE, "groupId" ).text( parent.getGroupId() ).endTag( NAMESPACE, "groupId" );
  }
  if ( parent.getArtifactId() != null )
  {
    serializer.startTag( NAMESPACE, "artifactId" ).text( parent.getArtifactId() ).endTag( NAMESPACE, "artifactId" );
  }
  if ( parent.getVersion() != null )
  {
    serializer.startTag( NAMESPACE, "version" ).text( parent.getVersion() ).endTag( NAMESPACE, "version" );
  }
  if ( ( parent.getRelativePath() != null ) && !parent.getRelativePath().equals( "../pom.xml" ) )
  {
    serializer.startTag( NAMESPACE, "relativePath" ).text( parent.getRelativePath() ).endTag( NAMESPACE, "relativePath" );
  }
  serializer.endTag( NAMESPACE, tagName );
} //-- void writeParent( Parent, String, XmlSerializer )

代码示例来源:origin: org.apache.maven/maven-project

if ( StringUtils.isEmpty( parentModel.getGroupId() ) )
else if ( parentModel.getGroupId().equals( model.getGroupId() ) &&
  parentModel.getArtifactId().equals( model.getArtifactId() ) )
  createCacheKey( parentModel.getGroupId(), parentModel.getArtifactId(), parentModel.getVersion() );
MavenProject parentProject = (MavenProject) rawProjectCache.get( parentKey );
    if ( ( candidateParentGroupId == null ) && ( candidateParent.getParent() != null ) )
      candidateParentGroupId = candidateParent.getParent().getGroupId();
    if ( parentModel.getGroupId().equals( candidateParentGroupId ) &&
      parentModel.getArtifactId().equals( candidateParent.getArtifactId() ) &&
      parentModel.getVersion().equals( candidateParentVersion ) )
  parentArtifact = artifactFactory.createParentArtifact( parentModel.getGroupId(),
                              parentModel.getArtifactId(),
                              parentModel.getVersion() );

代码示例来源:origin: apache/maven

String groupId = parent.getGroupId();
String artifactId = parent.getArtifactId();
String version = parent.getVersion();

代码示例来源:origin: apache/maven

if ( parent != null )
  validateStringNotEmpty( "parent.groupId", problems, Severity.FATAL, Version.BASE, parent.getGroupId(),
              parent );
              parent );
  if ( equals( parent.getGroupId(), m.getGroupId() ) && equals( parent.getArtifactId(), m.getArtifactId() ) )

代码示例来源:origin: takari/polyglot-maven

private void parent(PrintWriter pw, Model model) {
  if (model.getParent() != null) {
   pw.print(indent + "inherits: " + model.getParent().getGroupId() + ":" + model.getParent().getArtifactId() + ":" + model.getParent().getVersion());
   if (model.getParent().getRelativePath() != null) {
    //pw.println(":" + model.getParent().getRelativePath());
//        pw.println(":" + "../pom.atom");
   }
   pw.println();
  }
 }

代码示例来源:origin: mulesoft/mule

/**
 * Gets the Maven artifact located at the given by reading the {@value #POM_XML} file two levels up from target/classes.
 *
 * @param rootArtifactClassesFolder {@link File} the rootArtifactClassesFolder
 * @return {@link Artifact} that represents the rootArtifact
 */
private Artifact getRootArtifact(File rootArtifactClassesFolder) {
 File pomFile = new File(rootArtifactClassesFolder.getParentFile().getParentFile(), POM_XML);
 logger.debug("Reading rootArtifact from pom file: {}", pomFile);
 Model model = MavenModelFactory.createMavenProject(pomFile);
 return new DefaultArtifact(model.getGroupId() != null ? model.getGroupId() : model.getParent().getGroupId(),
               model.getArtifactId(), model.getPackaging(),
               model.getVersion() != null ? model.getVersion() : model.getParent().getVersion());
}

代码示例来源:origin: takari/polyglot-maven

private void id(PrintWriter pw, Model model) {
 String groupId = model.getGroupId();
 if (groupId == null & model.getParent() != null) {
  groupId = model.getParent().getGroupId();
 }
 String version = model.getVersion();
 if (version == null && model.getParent() != null) {
  version = model.getParent().getVersion();
 }
 pw.println(indent + "id: " + groupId + ":" + model.getArtifactId() + ":" + version);
}

代码示例来源:origin: takari/polyglot-maven

void id(Model model) {
  String groupId = model.getGroupId();
  if (groupId == null & model.getParent() != null) {
    groupId = model.getParent().getGroupId();
  }
  String version = model.getVersion();
  if (version == null && model.getParent() != null) {
    version = model.getParent().getVersion();
  }
  p.println("id", groupId + ":" + model.getArtifactId() + ":"
      + version);
}

相关文章