001    package org.apache.maven;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
005     * agreements. See the NOTICE file distributed with this work for additional information regarding
006     * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance with the License. You may obtain a
008     * copy of the License at
009     *
010     * http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software distributed under the License
013     * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
014     * or implied. See the License for the specific language governing permissions and limitations under
015     * the License.
016     */
017    
018    
019    import org.apache.maven.exception.ExceptionHandler;
020    import org.codehaus.plexus.component.annotations.Requirement;
021    
022    public class MavenTest
023        extends AbstractCoreMavenComponentTestCase
024    {
025        @Requirement
026        private Maven maven;
027    
028        @Requirement
029        private ExceptionHandler exceptionHandler;
030    
031        protected void setUp()
032            throws Exception
033        {
034            super.setUp();
035            maven = lookup( Maven.class );
036            exceptionHandler = lookup( ExceptionHandler.class );
037        }
038    
039        @Override
040        protected void tearDown()
041            throws Exception
042        {
043            maven = null;
044            exceptionHandler = null;
045            super.tearDown();
046        }
047    
048        protected String getProjectsDirectory()
049        {
050            return "src/test/projects/lifecycle-executor";
051        }
052    
053        public void testLifecycleExecutionUsingADefaultLifecyclePhase()
054            throws Exception
055        {
056            /*
057            File pom = getProject( "project-with-additional-lifecycle-elements" );
058            MavenExecutionRequest request = createMavenExecutionRequest( pom );
059            MavenExecutionResult result = maven.execute( request );
060            if ( result.hasExceptions() )
061            {
062                ExceptionSummary es = exceptionHandler.handleException( result.getExceptions().get( 0 ) );
063                System.out.println( es.getMessage() );
064                es.getException().printStackTrace();
065                fail( "Maven did not execute correctly." );
066            }
067            */
068        }
069    }