diff --git a/plugins/maven/maven.iml b/plugins/maven/maven.iml
index 208fc49323e2..01af8559a164 100644
--- a/plugins/maven/maven.iml
+++ b/plugins/maven/maven.iml
@@ -52,7 +52,7 @@
-
+
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyInjector.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyInjector.java
new file mode 100644
index 000000000000..35471567314f
--- /dev/null
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyInjector.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.maven.plugins.groovy;
+
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.InjectedLanguagePlaces;
+import com.intellij.psi.LanguageInjector;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiLanguageInjectionHost;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.psi.xml.XmlText;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.GroovyFileType;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public class MavenGroovyInjector implements LanguageInjector {
+ @Override
+ public void getLanguagesToInject(@NotNull PsiLanguageInjectionHost host, @NotNull InjectedLanguagePlaces injectionPlacesRegistrar) {
+ if (!(host instanceof XmlText)) return;
+
+ PsiElement sourceTag = host.getParent();
+ if (!isTagOfName(sourceTag, "source")) return;
+
+ PsiElement configurationTag = sourceTag.getParent();
+ if (!isTagOfName(configurationTag, "configuration")) return;
+
+ PsiElement executionTag = configurationTag.getParent();
+ if (!isTagOfName(executionTag, "execution")) return;
+
+ PsiElement executionsTag = executionTag.getParent();
+ if (!isTagOfName(executionsTag, "executions")) return;
+
+ PsiElement pluginTag = executionsTag.getParent();
+ if (!isTagOfName(pluginTag, "plugin")) return;
+
+ XmlTag plugin = (XmlTag)pluginTag;
+
+ XmlTag groupId = plugin.findFirstSubTag("groupId");
+ if (groupId == null || !groupId.getValue().getText().trim().equals("org.codehaus.groovy.maven")) return;
+
+ XmlTag artifactId = plugin.findFirstSubTag("artifactId");
+ if (artifactId == null || !artifactId.getValue().getText().trim().equals("gmaven-plugin")) return;
+
+ if (!"pom.xml".equals(plugin.getContainingFile().getName())) return;
+
+ injectionPlacesRegistrar.addPlace(GroovyFileType.GROOVY_LANGUAGE, TextRange.from(0, host.getTextLength()), null, null);
+ }
+
+ private static boolean isTagOfName(@Nullable PsiElement element, String name) {
+ return element instanceof XmlTag && name.equals(((XmlTag)element).getName());
+ }
+}
diff --git a/plugins/maven/src/main/resources/META-INF/groovy-support.xml b/plugins/maven/src/main/resources/META-INF/groovy-support.xml
index 764219a64b21..458ff05d910a 100644
--- a/plugins/maven/src/main/resources/META-INF/groovy-support.xml
+++ b/plugins/maven/src/main/resources/META-INF/groovy-support.xml
@@ -4,4 +4,7 @@
+
+
+
\ No newline at end of file
diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyInjectionTest.groovy b/plugins/maven/src/test/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyInjectionTest.groovy
new file mode 100644
index 000000000000..13b5a2d37a34
--- /dev/null
+++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/plugins/groovy/MavenGroovyInjectionTest.groovy
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.idea.maven.plugins.groovy
+
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+
+/**
+ * @author Sergey Evdokimov
+ */
+class MavenGroovyInjectionTest extends LightCodeInsightFixtureTestCase {
+
+ public void testCompletion() {
+ myFixture.configureByText("pom.xml", """
+
+
+ 4.0.0
+
+ simpleMaven
+ simpleMaven
+ 1.0
+
+ jar
+
+
+
+
+ org.codehaus.groovy.maven
+ gmaven-plugin
+ 1.0
+
+
+ groovy-magic
+ package
+
+ execute
+
+
+
+ String
+
+
+
+
+
+
+ org.apache.ant
+ ant-nodeps
+ 1.8.0
+
+
+
+
+
+
+
+""")
+
+ myFixture.completeBasic()
+
+ def lookups = myFixture.lookupElementStrings
+ assert lookups.containsAll(["String", "StringBuffer", "StringBuilder"])
+ }
+
+}