View Javadoc
1   package org.apache.maven;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
5    * agreements. See the NOTICE file distributed with this work for additional information regarding
6    * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance with the License. You may obtain a
8    * 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, software distributed under the License
13   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14   * or implied. See the License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  
18  
19  import org.apache.maven.exception.ExceptionHandler;
20  import org.codehaus.plexus.component.annotations.Requirement;
21  
22  public class MavenTest
23      extends AbstractCoreMavenComponentTestCase
24  {
25      @Requirement
26      private Maven maven;
27  
28      @Requirement
29      private ExceptionHandler exceptionHandler;
30  
31      protected void setUp()
32          throws Exception
33      {
34          super.setUp();
35          maven = lookup( Maven.class );
36          exceptionHandler = lookup( ExceptionHandler.class );
37      }
38  
39      @Override
40      protected void tearDown()
41          throws Exception
42      {
43          maven = null;
44          exceptionHandler = null;
45          super.tearDown();
46      }
47  
48      protected String getProjectsDirectory()
49      {
50          return "src/test/projects/lifecycle-executor";
51      }
52  
53      public void testLifecycleExecutionUsingADefaultLifecyclePhase()
54          throws Exception
55      {
56          /*
57          File pom = getProject( "project-with-additional-lifecycle-elements" );
58          MavenExecutionRequest request = createMavenExecutionRequest( pom );
59          MavenExecutionResult result = maven.execute( request );
60          if ( result.hasExceptions() )
61          {
62              ExceptionSummary es = exceptionHandler.handleException( result.getExceptions().get( 0 ) );
63              System.out.println( es.getMessage() );
64              es.getException().printStackTrace();
65              fail( "Maven did not execute correctly." );
66          }
67          */
68      }
69  }