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

x33g5p2x  于2022-01-24 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(117)

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

Model.getName介绍

[英]Get the full name of the project.
[中]获取项目的全名。

代码示例

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

public String getName()
{
  // TODO this should not be allowed to be null.
  if ( getModel().getName() != null )
  {
    return getModel().getName();
  }
  else
  {
    return getArtifactId();
  }
}

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

public String getName()
{
  // TODO: this should not be allowed to be null.
  if ( getModel().getName() != null )
  {
    return getModel().getName();
  }
  else
  {
    return "Unnamed - " + getId();
  }
}

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

protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
{
  String src = source.getName();
  if ( src != null )
  {
    if ( sourceDominant || target.getName() == null )
    {
      target.setName( src );
      target.setLocation( "name", source.getLocation( "name" ) );
    }
  }
}

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

@Override
protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
{
  String src = source.getName();
  if ( src != null )
  {
    if ( sourceDominant )
    {
      target.setName( src );
      target.setLocation( "name", source.getLocation( "name" ) );
    }
  }
}

代码示例来源:origin: stackoverflow.com

ArrayList<Model> modelList = new ArrayList<>();
modelList.add(new Model("chandru"));
modelList.add(new Model("mani"));
modelList.add(new Model("vivek"));
modelList.add(new Model("david"));

Collections.sort(modelList, new Comparator<Model>() {
  @Override
  public int compare(Model lhs, Model rhs) {
    return lhs.getName().compareTo(rhs.getName());
  }
});

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

if ( model.getName() != null )
  serializer.startTag( NAMESPACE, "name" ).text( model.getName() ).endTag( NAMESPACE, "name" );

代码示例来源:origin: opensourceBIM/BIMserver

@Override
public String getName() {
  return getModel().getName();
}

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

private void project(PrintWriter pw, Model model) {
 String name = model.getName();
 if (name == null) {
  name = model.getArtifactId();
 }
 String url = model.getUrl() == null ? "" : model.getUrl();
 pw.print("project \"" + name + "\" @ \"" + url + "\"");
 packaging(pw, model);
}

代码示例来源:origin: opensourceBIM/BIMserver

sPluginBundle.setName(model.getName());

代码示例来源:origin: opensourceBIM/BIMserver

@Override
public SPluginBundle getPluginBundle() {
  SPluginBundle result = new SPluginBundle();
  result.setName(model.getName());
  result.setOrganization(model.getOrganization().getName());
  return result;
}

代码示例来源:origin: opensourceBIM/BIMserver

public SPluginBundle extractPluginBundleFromJar(Path jarFilePath) throws PluginException {
  String filename = jarFilePath.getFileName().toString();
  PluginBundleVersionIdentifier pluginBundleVersionIdentifier = PluginBundleVersionIdentifier.fromFileName(filename);
  try (JarFile jarFile = new JarFile(jarFilePath.toFile())) {
    String pomLocation = "META-INF/maven/" + pluginBundleVersionIdentifier.getPluginBundleIdentifier().getGroupId() + "/" + pluginBundleVersionIdentifier.getPluginBundleIdentifier().getArtifactId() + "/" + "pom.xml";
    ZipEntry pomEntry = jarFile.getEntry(pomLocation);
    if (pomEntry == null) {
      throw new PluginException("No pom.xml found in JAR file " + jarFilePath.toString() + ", " + pomLocation);
    }
    MavenXpp3Reader mavenreader = new MavenXpp3Reader();
    Model model = mavenreader.read(jarFile.getInputStream(pomEntry));
    SPluginBundle sPluginBundle = new SPluginBundle();
    sPluginBundle.setOrganization(model.getOrganization().getName());
    sPluginBundle.setName(model.getName());
    return sPluginBundle;
  } catch (IOException e) {
    throw new PluginException(e);
  } catch (XmlPullParserException e) {
    throw new PluginException(e);
  }
}

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

result.setName( src.getName() );
result.setOrganization( cloneOrganization( src.getOrganization() ) );
result.setPackaging( src.getPackaging() );

代码示例来源:origin: opensourceBIM/BIMserver

sPluginBundle.setName(model.getName());

代码示例来源:origin: opensourceBIM/BIMserver

sPluginBundleVersion.setName(model.getName());
sPluginBundleVersion.setType(SPluginBundleType.MAVEN);
sPluginBundleVersion.setGroupId(groupId);

代码示例来源:origin: opensourceBIM/BIMserver

matchingPlugins++;
sPluginBundleVersion.setName(mavenPluginVersion.getModel().getName());
sPluginBundleVersion.setOrganization(mavenPluginVersion.getModel().getOrganization().getName());
sPluginBundleVersion.setArtifactId(mavenPluginLocation.getArtifactId());
sPluginBundleVersion.setDescription(mavenPluginVersion.getModel().getDescription());
pluginBundle.setName(mavenPluginVersion.getModel().getName());
pluginBundle.setOrganization(mavenPluginVersion.getModel().getOrganization().getName());
if (pluginBundle.getLatestVersion() == null) {

代码示例来源:origin: opensourceBIM/BIMserver

sPluginBundle.setName(model.getName());

代码示例来源:origin: opensourceBIM/BIMserver

private SPluginBundleVersion createPluginBundleVersionFromMavenModel(Model model, boolean isLocalDev) {
  SPluginBundleVersion sPluginBundleVersion = new SPluginBundleVersion();
  sPluginBundleVersion.setType(isLocalDev ? SPluginBundleType.LOCAL_DEV : SPluginBundleType.MAVEN);
  sPluginBundleVersion.setGroupId(model.getGroupId());
  sPluginBundleVersion.setArtifactId(model.getArtifactId());
  sPluginBundleVersion.setVersion(model.getVersion());
  sPluginBundleVersion.setDescription(model.getDescription());
  sPluginBundleVersion.setRepository("local");
  sPluginBundleVersion.setMismatch(false); // TODO
  sPluginBundleVersion.setOrganization(model.getOrganization().getName());
  sPluginBundleVersion.setName(model.getName());
  return sPluginBundleVersion;
}

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

if ( model.getName() != null )
  serializer.startTag( NAMESPACE, "name" ).text( model.getName() ).endTag( NAMESPACE, "name" );

代码示例来源:origin: opensourceBIM/BIMserver

@Override
  public SPluginBundleVersion getPluginBundleVersion() {
    SPluginBundleVersion sPluginBundleVersion = new SPluginBundleVersion();
    sPluginBundleVersion.setType(SPluginBundleType.LOCAL);
    sPluginBundleVersion.setGroupId(model.getGroupId());
    sPluginBundleVersion.setArtifactId(model.getArtifactId());
    sPluginBundleVersion.setVersion(model.getVersion());
    sPluginBundleVersion.setDescription(model.getDescription());
    sPluginBundleVersion.setRepository("local");
    sPluginBundleVersion.setMismatch(false); // TODO
    sPluginBundleVersion.setOrganization(model.getOrganization().getName());
    sPluginBundleVersion.setName(model.getName());
    return sPluginBundleVersion;
  }
}

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

void project(Model model) {
  String name = model.getName();
  if (name == null) {
    name = model.getArtifactId();
  }
  p.printStartBlock( "project", name, model.getUrl() );
  p.println();
  p.println( "model_version", model.getModelVersion() );
  p.println( "inception_year", model.getInceptionYear() );
  id(model);
  parent(model.getParent());
  p.println("packaging", model.getPackaging());
  p.println();
  description(model.getDescription());
  developers( model.getDevelopers() );
  issueManagement( model.getIssueManagement() );
  mailingLists( model.getMailingLists() );
  repositories( toRepositoryArray( model.getRepositories() ) );
  pluginRepositories( toRepositoryArray( model.getPluginRepositories() ) );
  sourceControl( model.getScm() );
  distribution( model.getDistributionManagement() );
  properties( model.getProperties() );
  dependencies( model.getDependencies() );
  modules( model.getModules() );
  managements( model.getDependencyManagement(), model.getBuild() );
  build( model.getBuild(), model.getBuild() );
  profiles( model.getProfiles() );
  reporting( model.getReporting() );
  p.printEndBlock();
}

相关文章

Model类方法