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

com.nathanaelrota.cmmi.maven.requirements.RequirementMojo Maven / Gradle / Ivy

The newest version!
package com.nathanaelrota.cmmi.maven.requirements;

/*
 * Copyright 2001-2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.File;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

/**
 * @goal traceability
 * @phase site
 */
public class RequirementMojo extends AbstractMojo {

   /**
    * @parameter expression="traceability" 
    */
   private String traceability;
   
   /**
    * @parameter expression="html"
    */
   private String format;
   
   /**
    * @parameter expression="${project.reporting.outputDirectory}"
    */
   private String outputDirectory;

   /**
    * @parameter expression="${project.build.directory}/test-classes/"
    */
   private String testDirectory;

   /**
    * TestCase File Pattern
    */
   private String testPattern = ".*Test.class";
   
   /**
    * @parameter expression="${project.build.directory}/classes/"
    */
   private String mainDirectory;

   /**
    * TestCase File Pattern
    */
   private String classPattern = ".*.class";
   
   /**
    * @parameter expression="${basedir}/src/main/resources"
    */
   private String inputDirectory;
   
   /**
    * @parameter expression="${project.name}"
    */
   private String project;
   
   /**
    * @parameter expression="requirements.xml"
    */
   private String requirements;
   
   /**
    * @parameter expression="false"
    */
   private Boolean surefireReport;
   
   public void execute() throws MojoExecutionException {
      File f = new File(outputDirectory);
      if (!f.exists()) {
         f.mkdirs();
      }
      String traceabilityFilename = outputDirectory + File.separator + traceability + "." + format;
      String requirementsFilename = inputDirectory + File.separator + requirements;
      
      RequirementMojoDelegate delegate = new RequirementMojoDelegate();
      delegate.setLog(super.getLog());
      delegate.setSurefireReport(surefireReport.booleanValue());
      delegate.setFormat(format);
      delegate.setProjectName(project);
      delegate.execute(requirementsFilename, testDirectory, testPattern, mainDirectory, classPattern, traceabilityFilename);

   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy