• maven笔记


    一、构建项目
    mvn archetype:create -DgroupId=com.maven.test -DartifactId=helloMaven -DpackageName=com.maven.test -DarchetypeArtifactId=maven-archetype-webapp -Dversion=1.0
    groupId //项目包名
    artifactId //项目名称
    archetype //是一个内建插件,他的create任务将建立项目骨架
    archetypeArtifactId //项目骨架的类型
    创建Maven项目:mvn archetype:create
    编译源代码:mvn compile
    编译测试代码:mvn test-compile
    运行测试:mvn test
    产生site:mvn site
    打包:mvn package
    在本地Repository中安装jar:mvn install
    清除产生的项目:mvn clean
    二、编译项目-生成eclipse的项目结构
    编译项目代码//建成我们eclipse可以导入的项目
    mvn clean compile
    Clean 告诉maven清理输入出目录target/,compile告诉maven编译项目主代码
    mvn eclipse:eclipse
    参考信息:http://www.cnblogs.com/fnng/archive/2011/12/02/2272610.html
    三、导入Eclipse
    配置maven仓库路径
    Window----Perferences-----java-----Build Path-----Classpath Variables
    四、包的更新与下载
    打开项目发现我们junit 是3.8.1的,有点老了。那我想换成4.7的,如何通过maven的方式更换呢。其实,很简单,打开我们项目下的的pom.xml文件。
    ……
    <dependencies>
    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.8.1</version>
    <scope>test</scope>
    </dependency>
    </dependencies>
    ……
    更改变,junit的版本号,然后重新执行:mvn eclipse:eclipse

  • 相关阅读:
    哈利波特买书事件
    闹钟类app构想
    梦断代码(7-尾)
    梦断代码(3-6)
    梦断代码(0-2)
    环形二维数组求最大子矩阵
    数组问题
    电梯考察
    四则运算的三张计划表
    团队开发用户需求调研
  • 原文地址:https://www.cnblogs.com/guaishushu/p/4126096.html
Copyright © 2020-2023  润新知