List of usage examples for org.apache.maven.lifecycle.mapping LifecycleMapping getPhases
@Deprecated
Map<String, String> getPhases(String lifecycle);
From source file:org.codehaus.mojo.versions.DisplayPluginUpdatesMojo.java
License:Apache License
/** * Find mappings for lifecycle.//from w w w. ja v a2s . co m * * @param project the project * @param lifecycle the lifecycle * @return the map * @throws LifecycleExecutionException the lifecycle execution exception * @throws PluginNotFoundException the plugin not found exception */ private Map findMappingsForLifecycle(MavenProject project, Lifecycle lifecycle) throws LifecycleExecutionException, PluginNotFoundException { String packaging = project.getPackaging(); Map mappings = null; LifecycleMapping m = (LifecycleMapping) findExtension(project, LifecycleMapping.ROLE, packaging, session.getSettings(), session.getLocalRepository()); if (m != null) { mappings = m.getPhases(lifecycle.getId()); } Map defaultMappings = lifecycle.getDefaultPhases(); if (mappings == null) { try { m = (LifecycleMapping) session.lookup(LifecycleMapping.ROLE, packaging); mappings = m.getPhases(lifecycle.getId()); } catch (ComponentLookupException e) { if (defaultMappings == null) { throw new LifecycleExecutionException( "Cannot find lifecycle mapping for packaging: \'" + packaging + "\'.", e); } } } if (mappings == null) { if (defaultMappings == null) { throw new LifecycleExecutionException("Cannot find lifecycle mapping for packaging: \'" + packaging + "\', and there is no default"); } else { mappings = defaultMappings; } } return mappings; }