Posted on 2013-01-10 13:33
Milo的海域 阅读(1283)
评论(0) 编辑 收藏 所属分类:
Java 、
Skills
mvn 执行外部命令命令行模式
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统计 <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>