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

 将下面的配置粘贴复制到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>
 

Eclipse Maven 配置

  在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

上传Jar包至私服命令:

请先查看具体步骤!!!

 # DgroupId、DartifactId、Dversion——表示的是Maven 构建的基本坐标,你需要根据你上次的jar包自行改变						
deploy:deploy-file   			 #  Maven  dependency  坐标	
  -DgroupId=com.lowagie   		 #  Maven 的 groupId坐标
  -DartifactId=iTextAsian 		 #  Maven 的 artifactId坐标
  -Dversion=2.0.7   			 #  Maven 的 version坐标 	
  -Dpackaging=jar  			 #  Dpackaging——表示的是上传的包的类型,一般为jar,不用改变,根据你的实际情况来改变。			
  -Dfile=E:\iTextAsian-2.0.7.jar		 #  表示的是上传的包的类型,一般为jar,不用改变,根据你的实际情况来改变。	
  -Durl=http://192.168.0.16:8080/repository/3rd-party/       # 表示的是你要上传到的私有仓库的地址
  -DrepositoryId=3rd-party    	 #  表示的你的Maven用户ID(Settings.xml中配置)					
  -X				             #  Debug Maven运行日志 	

这里来对这些参数进行说明:

  • DgroupId、DartifactId、Dversion——表示的是构建的基本坐标,你需要根据你上次的jar包自行改变
  • Dpackaging——表示的是上传的包的类型,一般为jar,不用改变,根据你的实际情况来改变。
  • Dfile——表示的是你需要上传的包的地址
  • Durl——表示的是你要上传到的私有仓库的地址
  • DrepositoryId——表示你的身份信息,可以从第二步获取。
扫描二维码关注公众号,回复: 9163692 查看本文章
发布了29 篇原创文章 · 获赞 9 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/qq_37977176/article/details/78146360
今日推荐