常用指令集
Init Project
- gradle init
- gradle init --type java-library
Build Project
- gradle clean build
Show all supported gradle tasks
- gradle tasks
Static Code Analysis (YOU MUST DO THIS)
- gradle check
- gradle findbugs各位先在Eclipse中裝好CheckStyle/PMD/FindBugs/Lint4j等驗測工具進行本地端掃描 (可於Eclipse Marketplace中進行安裝)
- CheckStyle教學: http://www.vogella.com/tutorials/Checkstyle/article.html
- PMD教學: http://goo.gl/JwwPI
- Lint4j: http://www.jutils.com/eclipse/
Unit Test
- gradle test
- gradle -x test // skip test測試完可於build/reports/資料夾觀察測試結果
Integration Test
- gradle integrationTest
- gradle -x integrationTest // skip integrationTest測試完可於build/reports/資料夾觀察測試結果
Liquibase
- gradle update // 執行DB Migration到最新版本
- gradle validate // Checks the changelog for errors
- gradle dropAll // Drops all database objects owned by the user
- gradle rollback // Rolls back the database to the state it was in when the tag was applied.
NOTE
- SQL檔內容必須要用Linux的換行字元:\n,避免Liquibase讀不到
- 若liquibase需要透過spring framework來整合啟動,則必須在spring beans的設定檔(ex: configs.xml)中加入以下XML程式碼片段: (可參考根專案底下src/main/resources/liquibase-springintegration.xml的設定)
- <bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase"><property name="dataSource" ref="dataSource" /><property name="changeLog" value="classpath:db/migration/changelog-master.yml" /><property name="dropFirst" value="true" /></bean>
- SQL檔請放置於src/main/resources/db/migration資料夾中
- Liquibase changelog檔案(src/main/resources/db/changelog-master.xml)必須進行以下宣告:databaseChangeLog:- preConditions:- runningAs:dbms: postgresqlusername: postgres- changeSet:id: 01_00_c_global_schema_20151005author: steedchanges:- sqlFile:path: ../migrate_sql/01_00_c_global_schema_20151005.sqlrelativeToChangelogFile: truerollback:- sqlFile:path: ../migrate_sql/01_00_c_global_schema_20151005_rollback.sqlrelativeToChangelogFile: true
Packaging Jar/War
- gradle jar
- gradle war
Watch Project Layout
- gradle projects
Show Project dependencies
- gradle dependencies
沒有留言:
張貼留言