maven学习2

#maven安装注意事项

  • 修改maven本地仓库的默认存放路径

修改setting.xml
settings.xml所造路径为:maven安装路径\conf\setting.xml,例如H:\java_develop\apache-maven-3.3.3-bin\apache-maven-3.3.3\conf\setting.xml). maven本地仓库默认目录为 u s e r . h o m e , {user.home}, user.home{user.home}是指“我的文档”。

<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">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
 
  -->
  

修改为本地其他目录,如下:

<localRepository>G:\maven\repository</localRepository>

同时,复制修改后的setting.xml至G:\maven\repository路径下

  • 远程中央仓库设置

maven安装路径\lib\maven-model-builder-3.3.3.jar包中可以查看到远程中央仓库的地址。
解压jar后

打开pom-4.0.0.xml,如下代码片中URL标签即为中央仓库地址

<repositories>
    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

使用浏览器打开https://repo.maven.apache.org/maven2,可以查询到项目中所有依赖的第三方jar包。

  • maven骨架工具

由于maven项目的目录结构是固定的,由此可以通过mvn archetype命令创建maven工程

mvn archetype: generate -DgroupId=com.zch.maven -DartifactId=maven01 -Dversion=1.0-SNAPSHOT

  • eclipse中配置maven插件
    参考如下链接中5~9步
    http://jingyan.baidu.com/article/60ccbceb01de4d64cbb19756.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值