Eclipse Helios + maven m2e + Groovy == FAIL

Ever since I installed the new m2e plugin for maven, my Groovy project no longer builds. I use the groovy compiler plugin as described here . I get the old "plugin execution not included ..." error for maven-compiler-plugin. I tried to execute and ignore the goals of "testCompile" and "compile" as described in this error.

I cannot use GMaven due to some cryptic compilers. I am also blocked by Maven 2.2.1 due to my company process. The old m2eclipse plugin is gone and the m2e documentation is terrible.

I finally agree with that. Nowhere do I see this problem. I cannot be the only one.

If I can’t find a solution to this very soon, I will either give up maven for some hacked implementation of Gradle (although I also can’t use it), or I will switch to NetBeans, which is not a winning offer.

As requested, the pom snippet is below.

<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.5</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>src/main/groovy</source> </sources> </configuration> </execution> <execution> <id>add-test-source</id> <phase>generate-test-sources</phase> <goals> <goal>add-test-source</goal> </goals> <configuration> <sources> <source>src/test/groovy</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.1</version> <configuration> <compilerId>groovy-eclipse-compiler</compilerId> <verbose>true</verbose> <source>1.6</source> <target>1.6</target> </configuration> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-batch</artifactId> <version>1.8.0-03</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <version>2.5.1</version> <exclusions> <exclusion> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-batch</artifactId> </exclusion> </exclusions> </dependency> </dependencies> </plugin> </plugins> <pluginManagement> <plugins> <!--This plugin configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <versionRange>[2.3.1,)</versionRange> <goals> <goal>testCompile</goal> <goal>compile</goal> </goals> </pluginExecutionFilter> <action> <execute /> </action> </pluginExecution> <pluginExecution> <pluginExecutionFilter> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <versionRange>[2.5.1,)</versionRange> <goals> <goal>testCompile</goal> <goal>compile</goal> </goals> </pluginExecutionFilter> <action> <execute /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> </build> 
+6
source share
2 answers

You must first install the correct configurator. I assume that you are using m2e version 1.0. If so, you should install the newer Groovy -Eclipse configurator for m2e. This site updates:

http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/

(Do not use the Groovy update site -m2eclipse-new. It is outdated and will disappear soon.)

I have not conducted extensive testing of the configurator on Eclipse 3.6, but it should work. I recommend that you upgrade to Eclipse Indigo, because everything will work better in Indigo.

Secondly, you need to fix your pom.xml. Remove the link to the org.eclipse.m2e plugin.

+8
source

Take a look at the following link posted to the groovy user group. Notice I used spring STS, which is the best eclipse. I also insert my pom for a test suite for your reference, pay attention to the sourceincludes element. I was also out of my mind trying to fix this, but it definitely works now. Also, make sure that maven in eclipse points to the one you installed on your computer, otherwise it can also cause problems.

[Update] Also install one of the following plugins depending on your version of eclipse to provide groovy - Maven integration http://dist.codehaus.org/groovy/distributions/greclipse/groovy-m2eclipse-new/ or http: // dist .codehaus.org / groovy / distributions / greclipse / groovy-m2eclipse /

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.org</groupId> <artifactId>test-suite</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>test-suite</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <repositories> <repository> <id>jetlang.googlecode.com</id> <name>Jetlang Repository for Maven</name> <url>http://jetlang.googlecode.com/svn/repo/</url> </repository> </repositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.1.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-ws-core</artifactId> <version>2.0.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.ws</groupId> <artifactId>spring-ws-support</artifactId> <version>2.0.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>3.0.5.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>3.0.5.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>3.0.5.RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jetlang</groupId> <artifactId>jetlang</artifactId> <version>0.2.5</version> </dependency> <!-- Database pool --> <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> <version>0.9.1.2</version> </dependency> <!-- ORACLE database driver --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc5</artifactId> <version>11.2.0.1.0</version> </dependency> <dependency> <groupId>jdom</groupId> <artifactId>jdom</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>xalan</groupId> <artifactId>xalan</artifactId> <version>2.7.1</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> <!-- Groovy jar --> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy</artifactId> <version>1.8.0</version> <type>jar</type> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.1</version> <configuration> <compilerId>groovy-eclipse-compiler</compilerId> <compilerArgument>nowarn</compilerArgument> <!--<verbose>true</verbose> --> </configuration> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-compiler</artifactId> <version>2.5.1-1</version> </dependency> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-batch</artifactId> <version>1.8.0-03</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.8</version> <configuration> <additionalProjectnatures> <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature> </additionalProjectnatures> <sourceIncludes> <sourceInclude>**/*.groovy</sourceInclude> </sourceIncludes> </configuration> </plugin> </plugins> </build> 

+1
source

Source: https://habr.com/ru/post/896761/


All Articles