Coverage Report - org.apache.maven.plugin.plugin.DescriptorGeneratorMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
DescriptorGeneratorMojo
0 %
0/7
0 %
0/2
1,667
 
 1  
 package org.apache.maven.plugin.plugin;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.plugin.MojoExecutionException;
 23  
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 24  
 import org.apache.maven.plugins.annotations.Mojo;
 25  
 import org.apache.maven.plugins.annotations.Parameter;
 26  
 import org.apache.maven.plugins.annotations.ResolutionScope;
 27  
 import org.apache.maven.tools.plugin.generator.Generator;
 28  
 import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
 29  
 
 30  
 import java.io.File;
 31  
 
 32  
 /**
 33  
  * Generate a plugin descriptor.
 34  
  * <br/>
 35  
  * <b>Note:</b> Since 3.0, <a href="http://maven.apache.org/ref/current/maven-core/lifecycles.html">phase</a>
 36  
  * is after the "compilation" of any scripts.
 37  
  *
 38  
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
 39  
  * @version $Id: DescriptorGeneratorMojo.java 1345787 2012-06-03 21:58:22Z hboutemy $
 40  
  * @since 2.0
 41  
  */
 42  
 @Mojo( name = "descriptor", defaultPhase = LifecyclePhase.PROCESS_CLASSES,
 43  
     requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true )
 44  0
 public class DescriptorGeneratorMojo
 45  
     extends AbstractGeneratorMojo
 46  
 {
 47  
     /**
 48  
      * The directory where the generated <code>plugin.xml</code> file will be put.
 49  
      */
 50  
     @Parameter( defaultValue = "${project.build.outputDirectory}/META-INF/maven" )
 51  
     protected File outputDirectory;
 52  
 
 53  
     /**
 54  
      * A flag to disable generation of the <code>plugin.xml</code> in favor of a hand authored plugin descriptor.
 55  
      * 
 56  
      * @since 2.6
 57  
      */
 58  
     @Parameter( defaultValue = "false" )
 59  
     private boolean skipDescriptor;
 60  
 
 61  
     /** {@inheritDoc} */
 62  
     protected File getOutputDirectory()
 63  
     {
 64  0
         return outputDirectory;
 65  
     }
 66  
 
 67  
     /** {@inheritDoc} */
 68  
     protected Generator createGenerator()
 69  
     {
 70  0
         return new PluginDescriptorGenerator();
 71  
     }
 72  
 
 73  
     /** {@inheritDoc} */
 74  
     public void execute()
 75  
         throws MojoExecutionException
 76  
     {
 77  0
         if ( skipDescriptor )
 78  
         {
 79  0
             return;
 80  
         }
 81  
 
 82  0
         super.execute();
 83  0
     }
 84  
 
 85  
 }