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

          一些項(xiàng)目中用到的mvn例子

          Posted on 2013-01-10 13:33 Milo的海域 閱讀(1294) 評(píng)論(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項(xiàng)目
          生成骨架
          mvn archetype:generate -DgroupId=com.abc.product -DartifactId=product -DpackageName=com.abc.product -DarchetypeArtifactId=maven-archetype-quickstart

          轉(zhuǎn)成eclipse能識(shí)別的java 項(xiàng)目
          mvn eclipse:eclipse
          導(dǎo)入eclipse 然后coding

          mvn進(jìn)行單元測(cè)試
                                  <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進(jìn)行code coverage統(tǒng)計(jì)
            <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>

          主站蜘蛛池模板: 赫章县| 万州区| 阿拉善盟| 喜德县| 瑞丽市| 黑河市| 仁化县| 德钦县| 云龙县| 六盘水市| 香河县| 黄冈市| 岫岩| 沙湾县| 郴州市| 永泰县| 长岛县| 集安市| 招远市| 中卫市| 合川市| 遂昌县| 泽州县| 察雅县| 高唐县| 淮南市| 资中县| 襄城县| 微博| 明溪县| 富蕴县| 托里县| 钟山县| 佛教| 鹤岗市| 曲阜市| 麦盖提县| 乐亭县| 友谊县| 讷河市| 忻城县|