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

The following examples show how to use org.apache.maven.model.Model#getPackaging() . 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 File: PomGetPackaging.java    From butterfly with 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
Source File: MavenFacetImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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
Source File: MavenRepositoryDeployer.java    From maven-repository-tools with Eclipse Public License 1.0 5 votes vote down vote up
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
Source File: DependencyMediatorMojo.java    From dependency-mediator with Apache License 2.0 5 votes vote down vote up
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
Source File: AttributesHelper.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
static String getPackaging(Model model) {
  String packaging = model.getPackaging();
  return packaging == null ? JAR : packaging;
}
 
Example 6
Source File: PomProperty.java    From flatten-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public String get( Model model )
{
    return model.getPackaging();
}