[maven] maven/appfuse 常用命令介绍

命令                                                       说明

mvn  idea:idea  产生idea项目(用 IDEA 开发你的项目)

mvn eclipse:eclipse        生成eclipse项目的配置文件,用户可直接把项目导入eclipse中

mvn  eclipse:clean  清除eclipse的一些系统设置

mvn jetty:run //运行程序不用打包,前提是必须删除webapp/web-inf/lib和webapp/web-inf/classes ,使用此命令启动时修改jsp或html不用重启jetty.

mvn jetty:run-war  打包发布应用程序到Jetty, 查看在 http://localhost:8080 ,如果发现 run不起来,发现是test的错误 那么run 的时候可以跳过,命令是: mvn jetty:run-war -Dmaven.test.skip=true

如果只修改了jsp ,  mvn –o war:exploded 如果修改了类 ,  mvn –o package –Dmaven.test.skip=true 如果修改了配置文件,资源文件等,需要将jetty停掉,再执行 mvn –o package –Dmaven.test.skip=true mvn package -Dmaven.test.skip=true   打包跳过测试

mvn  clean   清除产生的项目(target文件夹)

mvn compile   编译源代码

mvn  test-compile   -Dmaven.test.skip=true   编译测试代码,不运行测试

mvn test-compile -Dhibernate3:hbm2ddl.auto=none|validate|create|create-drop|update    数据库生成新表。

mvn install:install-file -DgroupId=mx4j -DartifactId=mx4j -Dversion=3.0.1 -Dpackaging=jar -Dfile=c:/mx4j-3.0.1.jar     本地Repository中安装jar

mvn appfuse:full-source           Converts AppFuse basic projects to full-source with no AppFuse dependencies. Currently does not work with modular archetypes.

mvn site     产生site,生成此项目的站点报告,供项目参与人员使用

mvn test -Dtest=AppTest    单元测试单个类(Action,Manager,Dao,Util层的测试)

mvn  integration-test  集成测试(包括所有单元测试以及生成一个tomcat嵌入式web容器进行web页面的测试)

mvn -e surefire-report:report   生成综合统计报表,并打印错误信息

一般模块的设计创建有两种方式,一种是先设计数据库,再根据数据库生成pojo,一種是先生成pojo,再根据pojo生成数据库。

appfuse都支持这两种方式。

如果用先設計數據庫的方式的話,那么在原先生成的數據中新增數據表,設計好表結構,然后在控制臺執行mvn appfuse:gen-model命令,(利用hibernate.reveng.ftl模板)就會自動生成對應的pojo,然后執行mvn appfuse:gen Dentity=pojoName,即可自動生成dao、service等類。

mvn appfuse:gen-model            Generates Java classes from database tables.

如果使用先生稱pojo類的方式,那么在com.company.model底下先新建一個pojo,使用JPA設置好數據庫映射,然后執行mvn appfuse:gen Dentity=pojoName,即可自動生成dao、service等類。

mvn appfuse:remove –Dentity=Person   删除类

mvn appfuse:gen  -Dentity=Person    根据pojo生成dao manger action 页面及他们的test。

如果你希望appfuses生成 dao 和 service 类,就在项目根目录下的pom.xml中,把genericCore属性设为false。

xml 代码

<project> 

... 

  <build> 

    <plugins> 

      <plugin> 

        <groupId>org.codehaus.mojo</groupId> 

        <artifactId>appfuse-maven-plugin</artifactId> 

        <version>2.0</version> 

        <configuration> 

          <genericCore>false</genericCore> <!-- Set to false if you want Java files generated for your DAOs and Managers --> 

         <fullSource>true</fullSource> <!-- Set to true if you've "full-sourced" your project and changed org.appfuse to your package name --> 

        </configuration> 

        <dependencies> 

          <dependency> 

            <groupId>${jdbc.groupId}</groupId> 

            <artifactId>${jdbc.artifactId}</artifactId> 

            <version>${jdbc.version}</version> 

          </dependency> 

        </dependencies> 

      </plugin> 

    </plugins> 

  </build> 

... 

</project> 

mvn dbunit:export -Ddest=c:/sample-data.xml

mvn dbunit:export -Ddest=src/test/resources/sample-data.xml 导出测试数据

导出命令是:mvn dbunit:export 将生成target/dbunit/export.xml里面包括表结构及数据资料。

导入命令是:mvn dbunit:operation重新导入数据。重新导入数据是根据pom.xml里面插件dbunit-maven-plugin中的src地址决定。

mvn  process-resources       处理资源

[转载自:http://blog.csdn.net/java20100406/article/details/6083284]

posted @ 2013-05-29 15:45  Kent_fighting  阅读(408)  评论(0编辑  收藏  举报