Coverage Report - org.codehaus.mojo.properties.ReadPropertiesMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
ReadPropertiesMojo
0% 
0% 
5
 
 1  
 package org.codehaus.mojo.properties;
 2  
 
 3  
 
 4  
 import org.apache.maven.plugin.AbstractMojo;
 5  
 import org.apache.maven.plugin.MojoExecutionException;
 6  
 import org.apache.maven.project.MavenProject;
 7  
 
 8  
 import java.io.File;
 9  
 import java.io.FileInputStream;
 10  
 
 11  
 /**
 12  
  * Reads property files as Project properties
 13  
  *
 14  
  * @author <a href="mailto:zarars@gmail.com">Zarar Siddiqi</a>
 15  
  * @version $Id$
 16  
  * @goal read-project-properties
 17  
  */
 18  0
 public class ReadPropertiesMojo
 19  
     extends AbstractMojo
 20  
 {
 21  
 
 22  
     /**
 23  
      * @parameter default-value="${project}"
 24  
      * @required
 25  
      * @readonly
 26  
      */
 27  
      private MavenProject project;
 28  
 
 29  
     /**
 30  
      * @parameter
 31  
      * @required
 32  
      */
 33  
     private File[] files;
 34  
 
 35  
     public void execute()
 36  
         throws MojoExecutionException {
 37  0
         for (int i = 0; i < files.length; i++) {
 38  0
             File file = files[i];
 39  
             try {
 40  0
                 FileInputStream stream = new FileInputStream(file);
 41  0
                 if (getLog().isDebugEnabled()) {
 42  0
                                         getLog().debug("Loading property file: " + file);
 43  
                                 }
 44  0
                 project.getProperties().load(stream);;
 45  0
                 stream.close();
 46  0
             } catch (Exception e) {
 47  0
                 throw new MojoExecutionException("Error: ", e);
 48  0
             }
 49  
         }
 50  0
     }
 51  
 }
 52