001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license 003 * agreements. See the NOTICE file distributed with this work for additional information regarding 004 * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the 005 * "License"); you may not use this file except in compliance with the License. You may obtain a 006 * copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software distributed under the License 011 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 012 * or implied. See the License for the specific language governing permissions and limitations under 013 * the License. 014 */ 015 016 package org.apache.maven.lifecycle.internal.stub; 017 018 import org.apache.maven.lifecycle.DefaultLifecycles; 019 import org.apache.maven.lifecycle.Lifecycle; 020 import org.apache.maven.lifecycle.Schedule; 021 import org.apache.maven.lifecycle.Scheduling; 022 023 import java.util.Arrays; 024 import java.util.HashMap; 025 import java.util.Iterator; 026 import java.util.List; 027 import java.util.Map; 028 029 import static org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub.*; 030 031 /** 032 * @author Kristian Rosenvold 033 */ 034 035 public class DefaultLifecyclesStub 036 { 037 public static DefaultLifecycles createDefaultLifecycles() 038 { 039 040 List<String> stubDefaultCycle = 041 Arrays.asList( VALIDATE.getPhase(), INITIALIZE.getPhase(), PROCESS_RESOURCES.getPhase(), COMPILE.getPhase(), 042 TEST.getPhase(), PROCESS_TEST_RESOURCES.getPhase(), PACKAGE.getPhase(), "BEER", 043 INSTALL.getPhase() ); 044 045 // The two phases below are really for future expansion, some would say they lack a drink 046 // The point being that they do not really have to match the "real" stuff, 047 List<String> stubCleanCycle = Arrays.asList( PRE_CLEAN.getPhase(), CLEAN.getPhase(), POST_CLEAN.getPhase() ); 048 049 List<String> stubSiteCycle = 050 Arrays.asList( PRE_SITE.getPhase(), SITE.getPhase(), POST_SITE.getPhase(), SITE_DEPLOY.getPhase() ); 051 052 Iterator<List<String>> lcs = Arrays.asList( stubDefaultCycle, stubCleanCycle, stubSiteCycle ).iterator(); 053 054 Map<String, Lifecycle> lifeCycles = new HashMap<String, Lifecycle>(); 055 for ( String s : DefaultLifecycles.STANDARD_LIFECYCLES ) 056 { 057 final Lifecycle lifecycle = new Lifecycle( s, lcs.next(), null ); 058 lifeCycles.put( s, lifecycle ); 059 060 } 061 return new DefaultLifecycles( lifeCycles, new LoggerStub() ); 062 } 063 064 public static List<Scheduling> getSchedulingList() 065 { 066 return Arrays.asList( new Scheduling( "default", Arrays.asList( new Schedule( "compile", false, false ), 067 new Schedule( "test", false, true ) ) ) ); 068 } 069 }