mave eclipse的使用配置

1,http://maven.apache.org/download.cgi下載maven

2,解壓maven,在目錄apache-maven-3.5.2\conf(找到自己解壓後對應的目錄)下找到settings.xml,打開進行編輯

   (1)添加<localRepository>D:/.m2/repository</localRepository>,指定默認的本地倉庫更改到D:/.m2/repository

   (2)需要自行添加其它的鏡像地址

    <mirror>
           <id>ibiblio</id>
           <mirrorOf>central</mirrorOf>
           <name>Human Readable Name for this Mirror.</name>
           <url>http://mirrors.ibiblio.org/maven2/</url>
    </mirror>

   (3)jdk版本

    <profile>
        <id>jdk-1.8</id>
        <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
        </activation>
        <properties>
           <maven.compiler.source>1.8</maven.compiler.source>
           <maven.compiler.target>1.8</maven.compiler.target>
           <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
       </properties>
  </profile> 

   (4)測試一下cmd輸入mvn help:system ,開始從遠程倉庫下載很多東西

3,eclipse配置

    (1)選擇window-preferences 雙擊Maven,點擊Installations,點擊add的maven目錄bin的上一次並打鉤,點擊User Settings 選擇Maven目錄的剛剛修改的settings.xml。

    (2)eclipse還需要安裝m2eclipse插件,Help-instance New SoftWare...”菜單項 ,點擊add自己起一個名字,然後Location輸入:  http://download.eclipse.org/technology/m2e/releases,選中“Maven Integration for Eclipse”前面的複選框然後next完成。

    (3)配置好後右鍵java web項目選擇Configure---Convert to mave project即可,在pom.xml中配置引用jar包例如

    <properties>
        <struts2.version>2.5.13</struts2.version>
    </properties>
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
        <version>${struts2.version}</version>
        <scope>runtime</scope>
    </dependency>
  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章