给eclipse添加maven插件

首先eclipse中的maven插件链接:https://pan.baidu.com/s/17CIsyVXAW_xvFQrgS-x7kA

然后windows-》preference-》选择maven-》installations-》add ,然后学则你的插件路径

如果你有本地仓库,你可以在maven-》Usersetting中配置你的maven仓库路径(其实你本地的maven有settings.mxl,该文件可以配置你的本地仓库),配置好后,eclipse自动会从settting.xml的文件中读出本次仓库

本地maven的setting.xml中配置本地仓库:只需添加

完成上述内容后:我们为了提高检索的速度,需要给maven创建检索

选择windows-》show view-》others-》maven-》maven repository

扫描二维码关注公众号,回复: 3055881 查看本文章

然后下方出现

然后点击 Local Repositories -》选择Local Repositories,然后右键-》选择Rebuilt index

如果按照上述配置后,你新建maven的项目报错:

你可以按照:1:检查是否缺少web.xml文件    即在项目的src-》main-》webapp下面添加web.xml文件,也可以右键项目-》jave EE tools -》Generate deployment descriptor stub 会自动生成web.xml

2:检查自己的jdk版本:可能不是我们需要(或项目制定的版本)我们可以在pom.xml文件中添加插件信息:来指定自己所有要的jdk版本,下面是jdkl和tomcat的配置实例。

两个都检查过了,然后右键项目-》Maven-》updata project  来更新一下项目

<plugins>
          <plugin>  
              <groupId>org.apache.maven.plugins</groupId>  
              <artifactId>maven-compiler-plugin</artifactId>  
              <version>2.3.2</version>  
              <configuration>  
                  <source>1.7</source>  
                  <target>1.7</target>  
              </configuration>  
          </plugin>  
          <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <configuration>
                    <!-- 指定端口 -->
                    <port>8080</port>
                    <!-- 请求路径 -->
                    <path>/</path>
                </configuration>
            </plugin>
      </plugins>  

猜你喜欢

转载自blog.csdn.net/qq_27922171/article/details/82356147