maven
czjuttsw
Learning, staying up to date, and working on the latest and greatest in languages and APIs is what keeps me excited.
展开
-
如何修改本地仓库的存储位置
步骤一: 在%M2_HOME%\conf文件夹中找到settings.xml (%M2_HOME% 为你的Maven根目录)步骤二: 修改标签localRepository的值。D:\path\repo 步骤三: 保存修改。原创 2013-05-17 20:45:00 · 2633 阅读 · 0 评论 -
clean的生命周期
Maven的生命周期clean主要是用来实现项目清理,它一共包括三个阶段:pre-clean,clean,post--clean。我们知道,生命周期的阶段和插件的目标是绑定关系,对于clean的三个阶段,clean阶段和maven-clean-plugin的clean目标绑定,而pre-clean和post-clean不存在绑定关系。如果我们在命令行中执行mvn clean指令,maven会执原创 2013-05-18 09:03:20 · 1900 阅读 · 0 评论 -
maven的本地仓库和中央仓库
本地仓库(local repository): 本地仓库其实就是一个文件夹,该文件夹里存放着许多从中央仓库或远程仓库下载过来的构件。该文件夹的默认位置因操作系统而异。如果是Windows,在C:\users\tsw\.m2\repository\,如果是Linux,在/home/tsw/.m2/repository/。中央仓库(central repository):中央仓库是Maven社区维原创 2013-05-18 09:13:39 · 2284 阅读 · 0 评论 -
Maven的安装
1. 首先需要确保安装了JDK。 在cmd中敲入java -version看是否有版本信息输出,如果输出 不是内部或外部命令,也不是可运行的程序说明java没有被安装。2. 到Maven官网下载最新的安装包。http://maven.apache.org/download.cgi 这里以Windows操作系统为例,选择下载apache-maven-VERSI原创 2013-05-20 21:06:59 · 3385 阅读 · 0 评论 -
将Maven项目转换成Eclipse支持的Java项目
当我们通过模版(比如最简单的maven-archetype-quikstart插件)生成了一个maven的项目结构时,如何将它转换成eclipse支持的java project呢?1. 定位到maven根目录下(该目录下必须有pom.xml)。2. 使用maven命令 mvn eclipse:eclipse3. 进入到根目录下,你会发现自动生成了熟悉的两个文件:.classpath 和原创 2013-05-21 14:10:31 · 39441 阅读 · 3 评论 -
Maven的超级POM
就像Java中的类隐式继承Object一样,对于pom.xml来说,它隐式继承超级POM。针对Maven3来说,该超级POM位于maven-model-builder-VERSION.jar包中(该jar包位于maven根目录/lib下)解压该jar包,可以在maven-model-builder-VERSION/org/apache/maven/model目录中找到pom-4.0.0.x原创 2013-05-22 00:00:08 · 7309 阅读 · 0 评论 -
Maven部署构件至远程仓库
我们知道,Maven仓库包括本地仓库和远程仓库,而远程仓库又包括中央仓库,私服,Jboss仓库和Java.net仓库等。私服,即私有的仓库服务器,它不仅可以降低中央仓库负荷,节省外网带宽,还可以加速Maven构建,自己部署构件等,从而高效地使用Maven。对于私服,我们可以使用仓库管理软件来创建自己的私有仓库服务器。目前网上流行的仓库管理软件有Apache的Achiva,JFrog的Artif原创 2013-05-22 13:20:29 · 16640 阅读 · 1 评论 -
Maven自定义绑定
将某个插件的目标绑定到生命周期的某个阶段。假设把maven-source-plugin插件的jar-no-fork目标绑定到default的verify阶段。(jar-no-fork主要用来创建项目的源码jar包)在pom.xml的根元素下添加以下内容: org.apache.maven.plugins maven-source-plugin 2.1原创 2013-05-22 16:15:56 · 7131 阅读 · 1 评论 -
Hibernate使用注解映射取代映射文件
在编写Hibernate的时候,需要将实体类映射到数据库中的表。通常需要一个配置文件(hibernate.cfg.xml),一个实体类(XX.java),还有一个映射文件(XX.hbm.xml)。从JAVA5.0之后,可以利用注解来简化配置。简单来说就是不再需要映射文件了,hibernate需要的元数据(metadata)通过注解实体类就行了。下面是一个简单的基于注解映射的Hibern原创 2013-06-30 13:50:29 · 28195 阅读 · 2 评论