use of org.jetbrains.idea.maven.model.MavenPlugin in project intellij-community by JetBrains.
the class MavenProjectTest method testMergingPluginConfigurationFromBuildProfilesAndPluginsManagement.
public void testMergingPluginConfigurationFromBuildProfilesAndPluginsManagement() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<profiles>" + " <profile>" + " <id>one</id>" + " <build>" + " <plugins>" + " <plugin>" + " <groupId>org.apache.maven.plugins</groupId>" + " <artifactId>maven-compiler-plugin</artifactId>" + " <configuration>" + " <target>1.4</target>" + " </configuration>" + " </plugin>" + " </plugins>" + " </build>" + " </profile>" + "</profiles>" + "<build>" + " <plugins>" + " <plugin>" + " <groupId>org.apache.maven.plugins</groupId>" + " <artifactId>maven-compiler-plugin</artifactId>" + " <configuration>" + " <debug>true</debug>" + " </configuration>" + " </plugin>" + " </plugins>" + " <pluginManagement>" + " <plugins>" + " <plugin>" + " <groupId>org.apache.maven.plugins</groupId>" + " <artifactId>maven-compiler-plugin</artifactId>" + " <configuration>" + " <source>1.4</source>" + " </configuration>" + " </plugin>" + " </plugins>" + " </pluginManagement>" + "</build>");
importProjectWithProfiles("one");
MavenPlugin plugin = findPlugin("org.apache.maven.plugins", "maven-compiler-plugin");
assertEquals("1.4", plugin.getConfigurationElement().getChildText("source"));
assertEquals("1.4", plugin.getConfigurationElement().getChildText("target"));
assertEquals("true", plugin.getConfigurationElement().getChildText("debug"));
}
use of org.jetbrains.idea.maven.model.MavenPlugin in project intellij-plugins by JetBrains.
the class FlexmojosImporter method resolve.
public void resolve(Project project, MavenProject mavenProject, NativeMavenProjectHolder nativeMavenProject, MavenEmbedderWrapper embedder, ResolveContext context) throws MavenProcessCanceledException {
final MavenPlugin plugin = getFlexmojosPlugin(mavenProject);
final String version = plugin.getVersion();
if (version != null && StringUtil.compareVersionNumbers(version, "4") < 0) {
embedder.resolvePlugin(plugin, mavenProject.getRemoteRepositories(), nativeMavenProject, true);
}
}
use of org.jetbrains.idea.maven.model.MavenPlugin in project intellij-plugins by JetBrains.
the class FlexmojosImporter method process.
public void process(final IdeModifiableModelsProvider modelsProvider, final Module module, final MavenRootModelAdapter modelAdapter, final MavenProjectsTree mavenTree, final MavenProject mavenProject, final MavenProjectChanges changes, final Map<MavenProject, String> mavenProjectToModuleName, final List<MavenProjectsProcessorTask> postTasks) {
expireNotification();
final FlexProjectConfigurationEditor currentEditor = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor();
final boolean needToCommit = currentEditor == null;
final LibraryTable.ModifiableModel projectLibrariesModel = modelsProvider.getModifiableProjectLibrariesModel();
final Map<Module, ModifiableRootModel> moduleToModifiableModel = Collections.singletonMap(module, modelAdapter.getRootModel());
final FlexProjectConfigurationEditor flexEditor = currentEditor != null ? currentEditor : new FlexProjectConfigurationEditor(module.getProject(), FlexProjectConfigurationEditor.createModelProvider(moduleToModifiableModel, projectLibrariesModel, null)) {
@Nullable
protected Module findModuleWithBC(final BuildConfigurationEntry bcEntry) {
// don't check BC presence here because corresponding BC may appear later in next import cycle
return modelAdapter.findModuleByName(bcEntry.getModuleName());
}
};
final MavenPlugin flexmojosPlugin = getFlexmojosPlugin(mavenProject);
final Flexmojos3Configurator configurator = StringUtil.compareVersionNumbers(flexmojosPlugin.getVersion(), "5") >= 0 ? new Flexmojos5Configurator(module, modelsProvider, flexEditor, mavenTree, mavenProjectToModuleName, mavenProject, flexmojosPlugin, getCompiledLocales(mavenProject), getRuntimeLocales(mavenProject), this) : StringUtil.compareVersionNumbers(flexmojosPlugin.getVersion(), "4") >= 0 ? new Flexmojos4Configurator(module, modelsProvider, flexEditor, mavenTree, mavenProjectToModuleName, mavenProject, flexmojosPlugin, getCompiledLocales(mavenProject), getRuntimeLocales(mavenProject), this) : new Flexmojos3Configurator(module, modelsProvider, flexEditor, mavenTree, mavenProjectToModuleName, mavenProject, flexmojosPlugin, getCompiledLocales(mavenProject), getRuntimeLocales(mavenProject), this);
configurator.configureAndAppendTasks(postTasks);
if (needToCommit) {
try {
flexEditor.commit();
} catch (ConfigurationException e) {
// can't happen
MavenLog.LOG.error(e);
}
}
}
Aggregations