All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.paypal.butterfly.utilities.pom.PomGetPackaging Maven / Gradle / Ivy

There is a newer version: 3.2.7
Show newest version
package com.paypal.butterfly.utilities.pom;

import com.paypal.butterfly.extensions.api.TUExecutionResult;
import org.apache.maven.model.Model;

/**
 * Retrieve the packaging of specified Maven artifact.
 * There are two ways to specify the Maven artifact:
 * 
    *
  1. As a context attribute, containing the Maven {@link Model} object
  2. *
  3. As a file, specified via regular {@link #relative(String)}, {@link #absolute(String)} or {@link #absolute(String, String)} methods
  4. *
* If Maven artifact is set with both options, the Maven model will be used, and the file will be ignored. * * @author facarvalho */ public class PomGetPackaging extends AbstractPomGetUtility { private static final String DESCRIPTION = "Retrieve the packaging of specified Maven POM module"; /** * Retrieve the packaging of specified Maven artifact. * There are two ways to specify the Maven artifact: *
    *
  1. As a file, specified via regular {@link #relative(String)}, {@link #absolute(String)} or {@link #absolute(String, String)} methods
  2. *
  3. As a context attribute, containing the Maven {@link org.apache.maven.model.Model} object
  4. *
* If Maven artifact is set with both options, the Maven model will be used, and the file will be ignored. */ public PomGetPackaging() { } /** * Retrieve the packaging of specified Maven artifact. * There are two ways to specify the Maven artifact: *
    *
  1. As a file, specified via regular {@link #relative(String)}, {@link #absolute(String)} or {@link #absolute(String, String)} methods
  2. *
  3. As a context attribute, containing the Maven {@link org.apache.maven.model.Model} object
  4. *
* If Maven artifact is set with both options, the Maven model will be used, and the file will be ignored. * * @param modelAttributeName the name of the context attribute containing the Maven {@link org.apache.maven.model.Model} object */ public PomGetPackaging(String modelAttributeName) { super(modelAttributeName); } @Override public String getDescription() { return String.format(DESCRIPTION); } @Override protected TUExecutionResult pomExecution(Model model) { String packaging = model.getPackaging(); if (packaging == null) { packaging = "jar"; } return TUExecutionResult.value(this, packaging); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy