@SuppressWarnings({"unchecked"}) private Map findArtifactTypeHandlers(MavenProject project) { // end copied from DefaultLifecycleExecutor.findExtensions Map result = new HashMap(); for (Object each : project.getBuildPlugins()) { Plugin eachPlugin = (Plugin)each; if (eachPlugin.isExtensions()) { try { PluginManager pluginManager = getComponent(PluginManager.class); pluginManager.verifyPlugin(eachPlugin, project, mySettings, myLocalRepository); result.putAll(pluginManager.getPluginComponents(eachPlugin, ArtifactHandler.ROLE)); } catch (Exception e) { MavenEmbedderLog.LOG.info(e); continue; } for (Object o : result.values()) { ArtifactHandler handler = (ArtifactHandler)o; if (project.getPackaging().equals(handler.getPackaging())) { project.getArtifact().setArtifactHandler(handler); } } } } return result; }
@Test public void testConstructor() throws Exception { Assert.assertEquals(expectedUrl, (String) getValueOfFieldInObject("url", wu)); Assert.assertEquals(up.getLog(), (Log) getValueOfFieldInObject("l", wu)); Assert.assertEquals(ws.getMojo().getProject(), (MavenProject) getValueOfFieldInObject("project", wu)); Assert.assertEquals(ws.getMojo().getPluginManager(), (PluginManager) getValueOfFieldInObject("pluginManager", wu)); Assert.assertEquals(ws.getMojo().getSession(), (MavenSession) getValueOfFieldInObject("session", wu)); Assert.assertEquals(expectedPackageFile, (File) getValueOfFieldInObject("packageFile", wu)); }
public PluginManager getPluginManager() { return pluginManager; }