posts - 88, comments - 3, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          一些項目中用到的mvn例子

          Posted on 2013-01-10 13:33 Milo的海域 閱讀(1294) 評論(0)  編輯  收藏 所屬分類: JavaSkills
          mvn 執(zhí)行外部命令
          命令行模式
          mvn exec:exec -Dexec.executable=sh -Dexec.workingdir=./bin -Dexec.args=hello.sh

          配置文件形式
                                  <plugin>
                                          <groupId>org.codehaus.mojo</groupId>
                                          <artifactId>exec-maven-plugin</artifactId>
                                          <executions>
                                                  <execution>
                                                          <id>test-exec</id>
                                                          <phase>initialize</phase>
                                                          <configuration>
                                                                  <executable>sh</executable>
                                                                  <workingDirectory>./bin</workingDirectory>
                                                                  <arguments>
                                                                          <argument>hello.sh</argument>
                                                                  </arguments>
                                                          </configuration>
                                                          <goals>
                                                                  <goal>exec</goal>
                                                          </goals>
                                                  </execution>
                                          </executions>
                                  </plugin>

          mvn 生成java項目
          生成骨架
          mvn archetype:generate -DgroupId=com.abc.product -DartifactId=product -DpackageName=com.abc.product -DarchetypeArtifactId=maven-archetype-quickstart

          轉成eclipse能識別的java 項目
          mvn eclipse:eclipse
          導入eclipse 然后coding

          mvn進行單元測試
                                  <plugin>
                                          <groupId>org.apache.maven.plugins</groupId>
                                          <artifactId>maven-surefire-plugin</artifactId>
                                          <version>
          2.12.4</version>
                                          <configuration>
                                                  <forkMode>pertest</forkMode>
                                                  <excludes>
                                                          <exclude>**/perftest/*.java</exclude>
                                                  </excludes>
                                                  <systemProperties>
                                                          <property>
                                                                  <name>log4j.configuration</name>
                                                                  <value>target/test-classes/log4j.properties</value>
                                                          </property>
                                                  </systemProperties>
                                          </configuration>
                                  </plugin>

          mvn進行code coverage統(tǒng)計
            <reporting>
              <plugins>
                <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>emma-maven-plugin</artifactId>
                  <version>1.0-alpha-3</version>
                  <inherited>true</inherited>
                </plugin>
                <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>surefire-report-maven-plugin</artifactId>
                  <inherited>true</inherited>
                </plugin>
              </plugins>
            </reporting>

          mvn生成javadoc
                                  <plugin>
                                          <groupId>org.apache.maven.plugins</groupId>
                                          <artifactId>maven-javadoc-plugin</artifactId>
                                          <version>
          2.9</version>
                                          <configuration>
                                                  <show>private</show>
                                          </configuration>
                                          <executions>
                                                  <execution>
                                                          <id>attach-javadocs</id>
                                                          <goals>
                                                                  <goal>javadoc</goal>
                                                                  <goal>test-javadoc</goal>
                                                          </goals>
                                                          <phase>site</phase>
                                                  </execution>
                                          </executions>
                                  </plugin>

          主站蜘蛛池模板: 玛沁县| 天门市| 揭阳市| 安义县| 定边县| 彩票| 嘉义县| 陆河县| 洪湖市| 五大连池市| 蓬莱市| 临汾市| 莒南县| 得荣县| 如东县| 铜陵市| 东方市| 清水县| 公安县| 项城市| 淳化县| 天津市| 台南县| 白水县| 白玉县| 开平市| 噶尔县| 龙山县| 济阳县| 汉沽区| 保山市| 英德市| 吉林省| 布尔津县| 略阳县| 无为县| 长宁县| 秦皇岛市| 长白| 康保县| 沁阳市|