Search in sources :

Example 6 with MavenPlugin

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"));
}
Also used : MavenPlugin(org.jetbrains.idea.maven.model.MavenPlugin)

Example 7 with MavenPlugin

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);
    }
}
Also used : MavenPlugin(org.jetbrains.idea.maven.model.MavenPlugin)

Example 8 with MavenPlugin

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);
        }
    }
}
Also used : MavenPlugin(org.jetbrains.idea.maven.model.MavenPlugin) ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) BuildConfigurationEntry(com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry) FlexProjectConfigurationEditor(com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor) LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) ConfigurationException(com.intellij.openapi.options.ConfigurationException) Module(com.intellij.openapi.module.Module) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

MavenPlugin (org.jetbrains.idea.maven.model.MavenPlugin)8 Element (org.jdom.Element)2 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 BuildConfigurationEntry (com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry)1 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)1 Module (com.intellij.openapi.module.Module)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)1 THashSet (gnu.trove.THashSet)1 File (java.io.File)1 Nullable (org.jetbrains.annotations.Nullable)1 MavenId (org.jetbrains.idea.maven.model.MavenId)1 MavenProject (org.jetbrains.idea.maven.project.MavenProject)1 OsmorcFacetConfiguration (org.osmorc.facet.OsmorcFacetConfiguration)1