Coverage Report - org.apache.maven.plugin.source.TestSourceJarNoForkMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
TestSourceJarNoForkMojo
83 %
5/6
50 %
1/2
1,667
 
 1  
 package org.apache.maven.plugin.source;
 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.model.Resource;
 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.project.MavenProject;
 27  
 
 28  
 import java.util.Collections;
 29  
 import java.util.List;
 30  
 
 31  
 /**
 32  
  * This goal bundles all the test sources into a jar archive.  This goal functions the same
 33  
  * as the test-jar goal but does not fork the build, and is suitable for attaching
 34  
  * to the build lifecycle.
 35  
  *
 36  
  * @since 2.1
 37  
  */
 38  
 @Mojo( name = "test-jar-no-fork", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true )
 39  3
 public class TestSourceJarNoForkMojo
 40  
     extends AbstractSourceJarMojo
 41  
 {
 42  
     /**
 43  
      * @since 2.2
 44  
      */
 45  
     @Parameter( property = "maven.source.test.classifier", defaultValue = "test-sources" )
 46  
     protected String classifier;
 47  
 
 48  
     /**
 49  
      * {@inheritDoc}
 50  
      */
 51  
     protected List<String> getSources( MavenProject p )
 52  
     {
 53  2
         return p.getTestCompileSourceRoots();
 54  
     }
 55  
 
 56  
     /**
 57  
      * {@inheritDoc}
 58  
      */
 59  
     protected List<Resource> getResources( MavenProject p )
 60  
     {
 61  2
         if ( excludeResources )
 62  
         {
 63  0
             return Collections.emptyList();
 64  
         }
 65  
 
 66  2
         return p.getTestResources();
 67  
     }
 68  
 
 69  
     /**
 70  
      * {@inheritDoc}
 71  
      */
 72  
     protected String getClassifier()
 73  
     {
 74  2
         return classifier;
 75  
     }
 76  
 }