Setup Maven plugin connectors Error

2019-03-03 01:44发布

问题:

I am trying to import a project into Spring Source Tool Suite (latest version).

The project was previously created from maven archetype cataloge.

I am getting the errors shown on the screenshot.

I was able to import the same project on a different machine but with the same maven repository (I copied the whole .m2 directory) without any problems.

Note: all of those tree bundles: com.springsource.bundlor.maven1.0.0.RELEASE, i18n-maven-plugin, maven-dependency-plugin are present in .m2/repository dir

Any idea on how to fix it?

screenshot with my error on the address below:

http://imageshack.us/photo/my-images/64/mavenpluginconnectors.png/

回答1:

Your error has nothing to do with the project or the maven configuration. It has to do with the fact that the new versions of Eclipse have the M2E (previously known as M2Eclipse) project built into it now.

The new version has been improved so that as it imports your Maven project it reads the pom and properly sets up the Eclipse project. To do this it needs various connectors, most of which are already available and configured to do the Right Thing. However, your plugin executions have not been pre-configured and so you need to tell M2E what you want to have happen when Eclipse does a Maven build.

For me, I configured M2E to "ignore" these executions by adding the following to BuildManagement:

            <plugin>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <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-dependency-plugin</artifactId>
                                    <versionRange>[1.0,)</versionRange>
                                    <goals>
                                        <goal>copy-dependencies</goal>
                                        <goal>unpack</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>hibernate3-maven-plugin</artifactId>
                                    <versionRange>[2.2,)</versionRange>
                                    <goals>
                                        <goal>hbm2ddl</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.sonatype.flexmojos</groupId>
                                    <artifactId>flexmojos-maven-plugin</artifactId>
                                    <versionRange>[4.0-RC2,)</versionRange>
                                    <goals>
                                        <goal>compile-swc</goal>
                                        <goal>compile-swf</goal>
                                        <goal>copy-flex-resources</goal>
                                        <goal>generate</goal>
                                        <goal>test-compile</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>

Read all about it here:

How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds



回答2:

I ran into this issue as well. I found the problem was that my project required an older version of Maven than what came installed with eclipse.

In my case, eclipse came with version 3.3.3 installed. I needed version 3.0.5

I downloaded and installed the appropriate version of maven I needed and added it to eclipse by going to: preferences > maven > installations.

When you build, if you're building through eclipse, make sure to select the correct version of maven. You should have two to choose from now. Run as -> Maven Build... -> Maven Runtime: *select the proper version*