您的位置:首页 > 编程语言 > Java开发

[Eclipse整合Maven远程仓库开发基础配置]

2017-10-01 09:30 507 查看
 将下面的配置粘贴复制到settings.xml
请先配置Maven的环境变量!!!!

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <!--本地Maven仓库服务 :SSH相关配置-->
    <!-- <localRepository>C:\repository</localRepository>-->

    <!--本地Maven仓库服务 :SSM相关配置-->
    <!-- <localRepository>C:\.m2\repository</localRepository>-->

    <!--当前使用:如果使用远程仓库1.不需要指定仓库默认User\用户名\.m2\repository,2.可以指定本地仓库下载位置  -->

    <localRepository>D:\ALocal\Maven_Jars</localRepository>

    <pluginGroups></pluginGroups>

    <proxies></proxies>
    <!--配置参考:
    http://www.sojson.com/blog/168.html  | Maven基础
    http://blog.csdn.net/haohaizijhz/article/details/72841489  | Maven配置多仓库镜像
    http://blog.csdn.net/caomiao2006/article/details/40401517  | mirror和repository 区别 http://wiki.jikexueyuan.com/project/intellij-idea-tutorial/maven-skill-introduce.html    | IntelliJ IDEA 配合 Maven 的一些技巧
      -->

    <!--阿里云中央Maven云服务-->
    <mirrors>

        <mirror>
            <!--id, name是该镜像的唯一定义符。id用来区分不同的mirror元素。 -->
            <id>aliyun</id>
            <name>aliyun maven</name>
            <!--url是该镜像的URL。构建系统会优先考虑使用该URL,而非使用默认的服务器URL。 -->
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>

            <!--<mirrorOf>的值为星号,表示该配置是匹配所有远程仓库。   -->
            <mirrorOf>*</mirrorOf>
        </mirror>

    </mirrors>
    <!--如果该镜像仓库需要认证,则配置setting.xml中的<server></server>即可。-->
<servers></servers>

    <profiles>

        <!--1.下载源码的配置-->
        <profile>
            <id>aliyun</id>
            <properties>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </properties>
        </profile>
        <!--1.下载源码的配置-->
<profile>

<!--阿里云中央仓库-->
 <profile>
            <id>aliyun</id>
            <repositories>
                <repository>
                    <id>aliyun</id>
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>aliyun</id>
                    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
</profiles>
<!--阿里云中央仓库-->

<!--当前使用的远程仓库名称-->
      <activeProfiles>
        <activeProfile>aliyun</activeProfile>
    </activeProfiles>
<!--当前使用的远程仓库名称-->

</settings>

 
  在Windiw的配置搜索栏选择Maven点User Settings 视图配置Settings.xml文件目录,默认下载插件的位置在.m2
配置选择框 Golbal Settings 选中conf\Settings.xml文件
完成后点击Apply保存操作;

  配置Maven视图:(显示Maven仓库的目录,这个视图可以找到有木有这个jar,) 
Window==》show View ==》Maven Repository==》保存==》到多视图栏,找到Maven Repository,右点Local  Repository ==》Rebuild Index(重建索引)==>提示框OK

将下面的配置粘贴复制到settings.xml

请先配置Maven的环境变量!!!!

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/
4000
1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
<!--本地Maven仓库服务 :SSH相关配置-->
<!-- <localRepository>C:\repository</localRepository>-->

<!--本地Maven仓库服务 :SSM相关配置-->
<!-- <localRepository>C:\.m2\repository</localRepository>-->

<!--当前使用:如果使用远程仓库1.不需要指定仓库默认User\用户名\.m2\repository,2.可以指定本地仓库下载位置  -->

<localRepository>D:\ALocal\Maven_Jars</localRepository>

<pluginGroups></pluginGroups>

<proxies></proxies>
<!--配置参考: http://www.sojson.com/blog/168.html  | Maven基础 http://blog.csdn.net/haohaizijhz/article/details/72841489  | Maven配置多仓库镜像 http://blog.csdn.net/caomiao2006/article/details/40401517  | mirror和repository 区别 http://wiki.jikexueyuan.com/project/intellij-idea-tutorial/maven-skill-introduce.html | IntelliJ IDEA 配合 Maven 的一些技巧
-->

<!--阿里云中央Maven云服务-->
<mirrors>

<mirror>
<!--id, name是该镜像的唯一定义符。id用来区分不同的mirror元素。 -->
<id>aliyun</id>
<name>aliyun maven</name>
<!--url是该镜像的URL。构建系统会优先考虑使用该URL,而非使用默认的服务器URL。 -->
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>

<!--<mirrorOf>的值为星号,表示该配置是匹配所有远程仓库。   -->
<mirrorOf>*</mirrorOf>
</mirror>

</mirrors>
<!--如果该镜像仓库需要认证,则配置setting.xml中的<server></server>即可。-->
<servers></servers>

<profiles>

<!--1.下载源码的配置-->
<profile>
<id>aliyun</id>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
<!--1.下载源码的配置-->
<profile>

<!--阿里云中央仓库-->
<profile>
<id>aliyun</id>
<repositories>
<repository>
<id>aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!--阿里云中央仓库-->

<!--当前使用的远程仓库名称-->
<activeProfiles>
<activeProfile>aliyun</activeProfile>
</activeProfiles>
<!--当前使用的远程仓库名称-->

</settings>

在Windiw的配置搜索栏选择Maven点User Settings 视图配置Settings.xml文件目录,默认下载插件的位置在.m2

配置选择框 Golbal Settings 选中conf\Settings.xml文件
完成后点击Apply保存操作;

配置Maven视图:(显示Maven仓库的目录,这个视图可以找到有木有这个jar,)

Window==》show View ==》Maven Repository==》保存==》到多视图栏,找到Maven Repository,右点Local  Repository ==》Rebuild Index(重建索引)==>提示框OK
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  maven eclipse