2010年6月29日 星期二

maven multi module

1. create parent pom

$ mvn archetype:create -DgroupId=test.project -DartifactId=test-parent
$ cd test-parent
$ rm -r src
$ vi pom.xml

修改<packaging>jar</pachaging> 為 <packaging>pom</pachaging>

2. create module

test-parent$ mvn archetype:create -DgroupId=test.project.core -DartifactId=test-core
test-parent$ mvn archetype:create -DgroupId=test.project.web -DartifactId=test-web -DarchetypeArtifactId=maven-archetype-webapp
test-parent$ cd test-web
test-parent$ vi pom.xml

在 <build> 內加上

<plugins>
<plugin>
<groupid>org.mortbay.jetty</groupid>
<artifactid>maven-jetty-plugin</artifactid>
</plugin>
</plugins>

test-parent$ mvn jetty:run

3. open browser

http://localhost:8080/test-web/

沒有留言: