Coverage Report - org.apache.maven.plugin.eclipse.M2EclipseMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
M2EclipseMojo
0%
0/17
0%
0/8
5
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.maven.plugin.eclipse;
 20  
 
 21  
 import java.util.ArrayList;
 22  
 import java.util.Collections;
 23  
 import java.util.List;
 24  
 
 25  
 import org.apache.maven.plugin.MojoExecutionException;
 26  
 
 27  
 /**
 28  
  * Creates an eclipse project that is ready to use with the M2Elipse plugin.
 29  
  * 
 30  
  * @goal m2eclipse
 31  
  * @execute phase="generate-resources"
 32  
  * @since 2.4
 33  
  */
 34  0
 public class M2EclipseMojo
 35  
     extends EclipsePlugin
 36  
 {
 37  
 
 38  
     protected static final String M2ECLIPSE_NATURE = "org.maven.ide.eclipse.maven2Nature";
 39  
 
 40  
     protected static final String M2ECLIPSE_BUILD_COMMAND = "org.maven.ide.eclipse.maven2Builder";
 41  
 
 42  
     protected static final String M2ECLIPSE_CLASSPATH_CONTAINER = "org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER";
 43  
 
 44  
     protected void setupExtras()
 45  
         throws MojoExecutionException
 46  
     {
 47  
         // disable normal dependency resolution; the m2eclipse plugin will handle it.
 48  0
         setResolveDependencies( false );
 49  
 
 50  0
         if ( getAdditionalProjectnatures() != null )
 51  
         {
 52  0
             getAdditionalProjectnatures().add( M2ECLIPSE_NATURE );
 53  
         }
 54  
         else
 55  
         {
 56  0
             setAdditionalProjectnatures( new ArrayList( Collections.singletonList( M2ECLIPSE_NATURE ) ) );
 57  
         }
 58  
 
 59  0
         if ( getAdditionalBuildcommands() != null )
 60  
         {
 61  0
             getAdditionalBuildcommands().add( M2ECLIPSE_BUILD_COMMAND );
 62  
         }
 63  
         else
 64  
         {
 65  0
             setAdditionalBuildcommands( new ArrayList( Collections.singletonList( M2ECLIPSE_BUILD_COMMAND ) ) );
 66  
         }
 67  
 
 68  0
         List classpathContainers = getClasspathContainers();
 69  0
         if ( classpathContainers == null )
 70  
         {
 71  0
             classpathContainers = new ArrayList();
 72  
 
 73  0
             classpathContainers.add( COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER );
 74  
 
 75  0
             if ( isPdeProject() )
 76  
             {
 77  0
                 classpathContainers.add( REQUIRED_PLUGINS_CONTAINER );
 78  
             }
 79  
         }
 80  
 
 81  0
         classpathContainers.add( M2ECLIPSE_CLASSPATH_CONTAINER );
 82  
 
 83  0
         setClasspathContainers( classpathContainers );
 84  0
     }
 85  
 
 86  
 }