Mavenとプロジェクトを統合する
このセクションでは、Mavenをシステムにインストールしたあとで、
既存のプロジェクトとMavenを統合する方法を示します。
現在のTurbineプロジェクトではすべてMavenに対応していますし、
リファレンスにもなります。
このセクションでは、それらのプロジェクトを例とします。
Mavenとプロジェクトの統合は、プロジェクトディスクリプタの生成のみで済みます。
更に、プロジェクト特有のgoal、preGoal、postGoalを含む補助的な
プロジェクトディスクリプタの作成Mavenのすべての事柄はプロジェクトの定義に自然と引き寄せられます。 作業の単位はプロジェクトであるため、Mavenを使用する前にプロジェクト定義を作成する必要があります。 最も簡単な方法は、定義をXMLで表現することです。 Mavenでは、これをプロジェクトディスクリプタと呼びます。
プロジェクトでMavenを使うために、プロジェクトディスクリプタを作る必要があります。
プロジェクトディスクリプタは、プロジェクトのディレクトリ構成の最上位に位置する
プロジェクトディスクリプタを自動的に作成するツールに取り組んでいます。
しかし、今すぐMavenを使うなら、 <?xml version="1.0"?>
<project>
<pomVersion>3</pomVersion>
<name>jakarta-turbine-maven</name>
<id>maven</id>
<currentVersion>1.0-b4-dev</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://jakarta.apache.org/</url>
</organization>
<inceptionYear>2001</inceptionYear>
<package>org.apache.maven</package>
<shortDescription>Java Project Management Tools</shortDescription>
<!-- Gump integration -->
<gumpRepositoryId>jakarta</gumpRepositoryId>
<description>
Maven is a project management and project comprehension
tool. Maven is based on the concept of a project object
model: builds, documentation creation, site publication,
and distribution publication are all controlled from the
project object model. Maven also provides tools to
create source metrics, change logs based directly on
source repository, and source cross-references.
</description>
<url>http://jakarta.apache.org/turbine/maven/</url>
<issueTrackingUrl>
http://nagoya.apache.org/scarab/servlet/scarab/
</issueTrackingUrl>
<siteAddress>jakarta.apache.org</siteAddress>
<siteDirectory>
/www/jakarta.apache.org/turbine/maven/
</siteDirectory>
<distributionDirectory>
/www/jakarta.apache.org/builds/jakarta-turbine-maven/
</distributionDirectory>
<repository>
<connection>
scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-turbine-maven
</connection>
<url>
http://cvs.apache.org/viewcvs/jakarta-turbine-maven/
</url>
</repository>
<versions>
<version>
<id>b3</id>
<name>1.0-b3</name>
<tag>MAVEN_1_0_B3</tag>
</version>
<version>
<id>b4</id>
<name>1.0-b4</name>
<tag>HEAD</tag>
</version>
</versions>
<mailingLists>
<mailingList>
<name>Maven User List</name>
<subscribe>
turbine-maven-user-subscribe@jakarta.apache.org
</subscribe>
<unsubscribe>
turbine-maven-user-unsubscribe@jakarta.apache.org
</unsubscribe>
<archive>
http://www.mail-archive.com/turbine-maven-user@jakarta.apache.org/
</archive>
</mailingList>
<mailingList>
<name>Maven Developer List</name>
<subscribe>
turbine-maven-dev-subscribe@jakarta.apache.org
</subscribe>
<unsubscribe>
turbine-maven-dev-unsubscribe@jakarta.apache.org
</unsubscribe>
<archive>
http://www.mail-archive.com/turbine-maven-dev@jakarta.apache.org/
</archive>
</mailingList>
</mailingLists>
<developers>
<developer>
<name>Juancarlo Anez</name>
<id>juanco</id>
<email>juanco@apache.org</email>
<organization></organization>
</developer>
<developer>
<name>Stephane Bailliez</name>
<id>sbailliez</id>
<email>sbailliez@apache.org</email>
<organization></organization>
</developer>
.
.
.
<developer>
<name>Glenn McAllister</name>
<id>glennm</id>
<email>glenn@somanetworks.com</email>
<organization>SOMA Networks, Inc.</organization>
</developer>
</developers>
<dependencies>
<dependency>
<id>dom4j</id>
<version>1.3</version>
<url>http://www.dom4j.org/</url>
</dependency>
<dependency>
<id>bcel</id>
<version>5.0</version>
<url>http://jakarta.apache.org/bcel/</url>
</dependency>
.
.
.
<dependency>
<id>regexp</id>
<version>1.2</version>
<url>http://jakarta.apache.org/regexp/</url>
</dependency>
</dependencies>
<build>
<nagEmailAddress>
turbine-maven-dev@jakarta.apache.org
</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<integrationUnitTestSourceDirectory/>
<aspectSourceDirectory/>
<!-- Unit test cases -->
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/RepositoryTest.java</exclude>
</excludes>
</unitTest>
<!-- J A R R E S O U R C E S -->
<!-- Resources that are packaged up inside the JAR file -->
<resources>
<includes>
<include>*.xsd</include>
<include>log4j.properties</include>
</includes>
</resources>
<!-- Integration unit test cases -->
<integrationUnitTest/>
<jars>
</jars>
</build>
</project>
既存のビルドでMavenを使用するMavenはAntビルドファイルを必要としません。 そのため、これまで使ってきたプロジェクトのビルドファイルに影響を与えることなくMavenを使用出来ます。 Mavenのビルドシステムを拡張する
2つの方法でMavenのビルドシステムを拡張できます:
1つは新しいPlug-inを作成すること。もう1つは追加の処理をプロジェクト固有の
|