Sunday, November 16, 2008

Apache Maven2 POM

Các fan của Java chắc hẳn ít nhiều gì cũng biết đến Ant , nhưng ít lập trình viên VN biết rằng Maven2 đã vượt qua mặt Ant để trở thành build tool chính cho rất nhiều dự án chuyên nghiệp .

Maven ban đầu được đặt tên là Project Object Model , nên file cấu hình của nó là pom.xml (lúc mới ra Maven1 thì là project.xml) . Cũng giống như để sử dụng Ant phải biết cấu trúc buildfile (build.xml) , muốn sử dụng tốt Maven thì nên nắm rõ cấu trúc pom.xml . Đại khái cấu trúc của nó như sau:




hoặc đơn giản hơn:





[BASIC]
groupId
artifactId
version
packaging

parent

modules

properties


[DEPENDENCIES]
dependencies
-[dependency[groupId, artifactId, version, scope, type, classifier]]


[BUILD]
build
-[sourceDirectory, resources, testResources, plugins[plugin[artifactId, executions[execution[phase, goals, configuration]]]]

reporting
-[outputDirectory, plugins[...]]


[PROJECT INFOR]
name
description
url
licenses
inceptionYear


[ENVIRONMENT]
profiles
repositories
pluginRepositories





Well, more confident now ?

No comments: