eclipse集成maven(四)

一、配置maven

打开Window-Preference-Maven,我们可以看到,默认是使用Eclipse的,不是我们要的maven,可以在Installations中,点击"Add",找到maven的安装路径,并勾选上。

二、修改maven配置setting

在User Setting中找到maven安装路径下的的settings.xml

“Global  Settings”可以不用填,但是“User Settings” 必须填,默认会寻找小范围的。

点击“open file” ,有几个需要配置的:

1. 本地仓库位置

<localRepository>E:/englishPath/respority</localRepository>

2. 镜像

因国外镜像比较慢,所以我们配置国内的一些镜像

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror> 
<mirror>
    <id>jboss-public-repository-group</id>
    <mirrorOf>central</mirrorOf>
    <name>JBoss Public Repository Group</name>
    <url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
    <id>ibiblio</id>
    <mirrorOf>central</mirrorOf>
    <name>Human Readable Name for this Mirror.</name>
    <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
    <id>central</id>
    <name>Maven Repository Switchboard</name>
    <url>http://repo1.maven.org/maven2/</url>
    <mirrorOf>central</mirrorOf>
</mirror>
<mirror>
    <id>repo2</id>
    <mirrorOf>central</mirrorOf>
    <name>Human Readable Name for this Mirror.</name>
    <url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
    <id>nexus-pentaho</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus pentaho</name>
    <url>https://nexus.pentaho.org/content/repositories/omni/</url>
</mirror>

3.  配置JDK

新建Maven项目之前必须先配置好JDK,否则默认下载的是1.4或1.5的。

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

猜你喜欢

转载自www.cnblogs.com/myitnews/p/11456376.html