Java Code Examples for org.apache.maven.model.Model#getPackaging()

The following examples show how to use org.apache.maven.model.Model#getPackaging() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: butterfly   File: PomGetPackaging.java    License: MIT License 5 votes vote down vote up
@Override
protected TUExecutionResult pomExecution(Model model) {
    String packaging = model.getPackaging();
    if (packaging == null) {
        packaging = "jar";
    }

    return TUExecutionResult.value(this, packaging);
}
 
Example 2
/**
 * Parses model from {@link AssetBlob} and sets {@link Component} attributes.
 */
private void fillInFromModel(final MavenPath mavenPath,
                             final AssetBlob assetBlob,
                             final NestedAttributesMap componentAttributes) throws IOException
{
  Model model = MavenModels.readModel(assetBlob.getBlob().getInputStream());
  if (model == null) {
    log.warn("Could not parse POM: {} @ {}", getRepository().getName(), mavenPath.getPath());
    return;
  }
  String packaging = model.getPackaging();
  componentAttributes.set(P_PACKAGING, packaging == null ? "jar" : packaging);
  componentAttributes.set(P_POM_NAME, model.getName());
  componentAttributes.set(P_POM_DESCRIPTION, model.getDescription());
}
 
Example 3
public static Gav getCoordinates ( File pomFile ) throws Exception
{
    BufferedReader in = new BufferedReader( new FileReader( pomFile ) );
    MavenXpp3Reader reader = new MavenXpp3Reader();
    Model model = reader.read( in );
    // get coordinates and take care of inheritance and default
    String g = model.getGroupId();
    if ( StringUtils.isEmpty( g ) ) 
    {
        g = model.getParent().getGroupId();
    }
    String a = model.getArtifactId();
    if ( StringUtils.isEmpty( a ) ) 
    {
        a = model.getParent().getArtifactId();
    }
    String v = model.getVersion();
    if ( StringUtils.isEmpty( v ) ) 
    {
        v = model.getParent().getVersion();
    }
    String p = model.getPackaging();
    if ( StringUtils.isEmpty( p ) ) 
    {
        p = MavenConstants.JAR;
    }
    Gav gav = new Gav( g, a, v, p );
    return gav;
}
 
Example 4
private void doExecute() throws MojoExecutionException {
    Model model = project.getModel();
    String packagingType = model.getPackaging();
    if (ComponentFormat.WAR.getValue().equalsIgnoreCase(packagingType)) {
        processWarPackage();
        printResult();
    } else {
        processPackage();
    }
}
 
Example 5
static String getPackaging(Model model) {
  String packaging = model.getPackaging();
  return packaging == null ? JAR : packaging;
}
 
Example 6
@Override
public String get( Model model )
{
    return model.getPackaging();
}