Terry.Li-彬

          虛其心,可解天下之問;專其心,可治天下之學;靜其心,可悟天下之理;恒其心,可成天下之業。

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            143 隨筆 :: 344 文章 :: 130 評論 :: 0 Trackbacks

          MAVEN 一結
           1.安裝:略
           2. make first Maven 78
            cmd: mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app
          notice: archetype==template    -D看cmd-> mvn -help
          將產生一個pom.xml(project object model)文件

          maven工程產生:
          mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app


          文檔產生:
          mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app
          -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-site
          格式(大概)如下
          project
            modelVersion使用pom的版本號
            groupId  組ID 如org.apache.maven.plugins或com.sourceware
            artifactId 類似工程名unique
            packaging打包(jar或war,ear由artifactId的extension定
            version該工程的版本號
            name顯示名稱在文檔里
            url   url在文檔里
            description描述在文檔里
            更詳細的見maven.htm(旁)
           
          mvn的命令在maven-command.htm里

          MAVEN與ANT整合如下
          <project>
            <modelVersion>4.0.0</modelVersion>
            <artifactId>my-test-app</artifactId>
            <groupId>my-test-group</groupId>
            <version>1.0-SNAPSHOT</version>
            <build>
              <plugins>
                <plugin>
                  <artifactId>maven-antrun-plugin</artifactId>
                  <executions>
                    <execution>
                      <phase>generate-sources</phase>
                      <configuration>
                        <tasks>

                          <!--
                            Place any ant task here. You can add anything
                            you can add between <target> and </target> in a
                            build.xml.
                          -->

                        </tasks>
                      </configuration>
                      <goals>
                        <goal>run</goal>
                      </goals>
                    </execution>
                  </executions>
                </plugin>
              </plugins>
            </build>
          </project>
          So a concrete example would be something like the following:

          <project>
            <modelVersion>4.0.0</modelVersion>
            <artifactId>my-test-app</artifactId>
            <groupId>my-test-group</groupId>
            <version>1.0-SNAPSHOT</version>
            <build>
              <plugins>
                <plugin>
                  <artifactId>maven-antrun-plugin</artifactId>
                  <executions>
                    <execution>
                      <phase>generate-sources</phase>
                      <configuration>
                        <tasks>
                          <exec
                            dir="${basedir}"
                            executable="${basedir}/src/main/sh/do-something.sh"
                            failonerror="true">
                            <arg line="arg1 arg2 arg3 arg4" />
                          </exec>
                        </tasks>
                      </configuration>
                      <goals>
                        <goal>run</goal>
                      </goals>
                    </execution>
                  </executions>
                </plugin>
              </plugins>
            </build>
          </project>

          posted on 2008-01-10 19:42 禮物 閱讀(405) 評論(0)  編輯  收藏 所屬分類: maven2
          主站蜘蛛池模板: 蓝田县| 柘荣县| 华安县| 清原| 桦南县| 泰顺县| 泗洪县| 张掖市| 桦甸市| 台中市| 永定县| 陆良县| 深水埗区| 宣城市| 海盐县| 营口市| 淮南市| 平遥县| 泗洪县| 英超| 新源县| 台中市| 施甸县| 获嘉县| 泗洪县| 喀喇| 九龙坡区| 平阴县| 塘沽区| 河源市| 锡林郭勒盟| 论坛| 湘潭县| 尚义县| 分宜县| 吉隆县| 台湾省| 乌拉特中旗| 丰原市| 星子县| 清新县|