`

maven usage guide

    博客分类:
  • tool
阅读更多

 edit at 2012-12-09

学习全在于应用,实例是个很好的学习方法,所以外网配上maven环境,方便构建工程。
 
1.安装maven
    安装maven3.0.4,配置maven环境变量M2_HOME和M2。
    使用mvn -version测试基本环境。
    按照maven官网[1]创建测试例子,会有一段时间的加载构建。最好在当前用户目录下建立.m2文件夹,复制setting.xml。默认是使用apache的公共仓库。
 
2.安装m2e插件
    没找到插件的安装包,可以同过Help->install new software:http://download.eclipse.org/technology/m2e/releases安装[2]    
   
    
3.配置
    默认apache中央仓库可能无能访问,这时候需要配置mirror[3],在setting.xml的mirrors下中添加
  
<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>

 

 
 
4. 常见问题
Q1:怎么自定义mvn命令,例如compile?
Run as --> mvn build... goal选项中填写:compile
【运行按钮】-> Organize Favorites... 可以收藏自定义的命令,快速访问。
 
Q2:如果获取依赖包失败怎么处理?
del /s *.lastUpdated  删除maven本地库中的lastUpdated文件,maven会重新尝试下载;或者通过网站访问手动下载,再放到对应的目录
 
 
linux shell use: find -name \*.lastUpdated -delete

 

分享到:
评论
1 楼 lingceng 2012-09-09  
<mirror>
      <id>UK</id>
      <name>UK Central</name>
      <url>http://uk.maven.org/maven2</url>
      <mirrorOf>central</mirrorOf>
</mirror>
最近用这个源,快一些。

相关推荐

    Apache.Maven.Cookbook.1785286129

    Over 90 hands-on recipes to successfully build and automate development life cycle tasks following Maven conventions and best practices About This Book ...Chapter 11: Advanced Maven Usage

    Android代码-GuideDialog

    ... 欢迎关注微信公众号 1. 在project的build.gradle添加如下代码... .setImages(new int[]{R.drawable.new_user_guide_1, R.drawable.new_user_guide_2, R.drawable.new_user_guide_3, R.drawable.new_user_guide_4})

    Android代码-hamcrest-pojo-matcher-generator

    Hamcrest Feature Matcher Generator for POJOs Inspired by lot of dummy work to create matchers for fields in auto-generated beans to...Usage Guide 1. Add dependency from Maven Central ru.yandex.qatool

    Gradle in Action

    It extends the usage patterns established by its forerunners, Ant and Maven, and allows builds that are expressive, maintainable, and easy to understand. Using a flexible Groovy-based DSL, Gradle ...

    Android代码-introduction

    Usage Options Use Gifs as images Runtime Permissions Styles Custom Views Further reading Upgrade Guide 1.1.0 to 1.1.1 1.0.x to 1.1.0 Metrics Contributions and contributors Acknowledgments ...

    Android-ObservableScrollView

    Build Status Coverage Status Maven Central API Android Arsenal Android library to observe scroll events on scrollable views. It's easy to interact with the Toolbar introduced in Android 5.0 Lollipop ...

Global site tag (gtag.js) - Google Analytics