zoukankan      html  css  js  c++  java
  • 第二章 eclipse中m2e插件问题

    1、当引入一个maven项目到eclipse中时,这时候可能会出现找不到一个插件的问题,例如:

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <configuration>
                        <configLocation>static-analysis/checkstyle.xml</configLocation>
                        <failsOnError>false</failsOnError>
                        <consoleOutput>true</consoleOutput>
                    </configuration>
                </plugin>
    View Code

    在eclipse中可能会出现找不到这个插件的问题,这是因为eclipse的m2e插件对checkstyle这个插件的支持不好。解决方式:

    在该pom.xml中加入以下的配置:

            <!-- 仅仅用于eclipse中m2e插件的补充,如果用的是idea,请忽略 -->
            <pluginManagement>
                <plugins>
                    <!--This plugin's 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-checkstyle-plugin
                                            </artifactId>
                                            <versionRange>
                                                [2.12.1,)
                                            </versionRange>
                                            <goals>
                                                <goal>checkstyle</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <ignore></ignore>
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
    View Code

    注意:

    • 上边的这段配置仅仅对eclipse有用,对于idea而言,因为其对maven的支持非常好,不需要增加这个配置。
    • 上边这段代码的配置所在的位置:

      

  • 相关阅读:
    while循环
    No.四
    No. three
    第二章吧
    第二次写博客
    我人生的第一个程序,相当于哥伦布发现新大路。
    orale命令6 rman备份
    oracle 命令4 热备份
    oracle命令3 冷备份
    oracle命令2 和一致性关闭、非一致性关闭
  • 原文地址:https://www.cnblogs.com/java-zhao/p/5307667.html
Copyright © 2011-2022 走看看