Mavenお仕着せのディレクトリ構成を受け入れることにより、
コマンド一発でコンパイル・テスト・Jar作成などができる。
すばらしい!
コントロールパネル > システム > システムのプロパティ > 詳細設定タブ > 環境変数ボタン
MAVEN_HOME | C:\Maven2 |
PATH | …(既存)…;%MAVEN_HOME%\bin |
C:\>mvn --version Maven version: 2.0.4
C:\>mkdir apps C:\>cd apps C:\apps>mvn archetype:generate -DgroupId=com.snail.hello -DartifactId=helloMaven [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------- --- [INFO] Building Maven Default Project [INFO] task-segment: [archetype:create] (aggregator-style) [INFO] ------------------------------------------------------------------------- --- ... [INFO] Parameter: artifactId, Value: helloMaven [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] Archetype created in dir: C:\apps\helloMaven [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9 seconds [INFO] Finished at: Wed May 24 00:47:45 JST 2006 [INFO] Final Memory: 4M/8M [INFO] ------------------------------------------------------------------------
C:\apps>tree /F フォルダ パスの一覧: ボリューム IBM_PRELOAD ボリューム シリアル番号は 0000403A 40F6:CC2B です C:. └─helloMaven │ pom.xml │ └─src ├─main │ └─java │ └─com │ └─snail │ └─hello │ App.java │ └─test └─java └─com └─snail └─hello AppTest.java
C:\apps>cd helloMaven C:\apps\helloMaven>mvn compile [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------- --- [INFO] Building Maven Quick Start Archetype [INFO] task-segment: [compile] [INFO] ------------------------------------------------------------------------- --- [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-a pi/1.5.2/plexus-compiler-api-1.5.2.pom 624b downloaded Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1 .5.2/plexus-compiler-1.5.2.pom 761b downloaded ... [INFO] [compiler:compile] Compiling 1 source file to C:\apps\helloMaven\target\classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 33 seconds [INFO] Finished at: Wed May 24 01:00:44 JST 2006 [INFO] Final Memory: 2M/8M [INFO] ------------------------------------------------------------------------
C:\apps\helloMaven>tree /F フォルダ パスの一覧: ボリューム IBM_PRELOAD ボリューム シリアル番号は 0000A97C 40F6:CC2B です C:. │ pom.xml │ ├─src │ ├─main │ │ └─java │ │ └─com │ │ └─snail │ │ └─hello │ │ App.java │ │ │ └─test │ └─java │ └─com │ └─snail │ └─hello │ AppTest.java │ └─target └─classes └─com └─snail └─hello App.class
C:\apps\helloMaven>mvn test [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------- --- [INFO] Building Maven Quick Start Archetype [INFO] task-segment: [test] [INFO] ------------------------------------------------------------------------- --- [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. Downloading: http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar 118K downloaded [INFO] [compiler:testCompile] Compiling 1 source file to C:\apps\helloMaven\target\test-classes Downloading: http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire-bo ... Downloading: http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire-ju nit/2.0/surefire-junit-2.0.jar 11K downloaded [INFO] Surefire report directory: C:\apps\helloMaven\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.snail.hello.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.421 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 28 seconds [INFO] Finished at: Wed May 24 01:05:16 JST 2006 [INFO] Final Memory: 3M/12M [INFO] ------------------------------------------------------------------------
C:\apps\helloMaven>mvn install [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------- --- [INFO] Building Maven Quick Start Archetype [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------- --- [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:testCompile] [INFO] Nothing to compile - all classes are up to date [INFO] [surefire:test] [INFO] Surefire report directory: C:\apps\helloMaven\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.snail.hello.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.11 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [jar:jar] [INFO] Building jar: C:\apps\helloMaven\target\helloMaven-1.0-SNAPSHOT.jar [INFO] [install:install] [INFO] Installing C:\apps\helloMaven\target\helloMaven-1.0-SNAPSHOT.jar to C:\Do cuments and Settings\kagyuu\.m2\repository\com\snail\hello\helloMaven\1.0-SNAPSH OT\helloMaven-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7 seconds [INFO] Finished at: Wed May 24 01:13:00 JST 2006 [INFO] Final Memory: 3M/7M [INFO] ------------------------------------------------------------------------
C:\apps\helloMaven>tree /F フォルダ パスの一覧: ボリューム IBM_PRELOAD ボリューム シリアル番号は 0000A0B6 40F6:CC2B です C:. │ pom.xml │ ├─src │ ├─main │ │ └─java │ │ └─com │ │ └─snail │ │ └─hello │ │ App.java │ │ │ └─test │ └─java │ └─com │ └─snail │ └─hello │ AppTest.java │ └─target │ exported-pom.xml │ helloMaven-1.0-SNAPSHOT.jar │ ├─classes │ └─com │ └─snail │ └─hello │ App.class │ ├─surefire-reports │ com.snail.hello.AppTest.txt │ TEST-com.snail.hello.AppTest.xml │ └─test-classes └─com └─snail └─hello AppTest.class
C:\apps\helloMaven>mvn site ... Downloading: http://repo1.maven.org/maven2/org/apache/maven/skins/maven-default- skin/1.0/maven-default-skin-1.0.jar 7K downloaded [INFO] Generate "Continuous Integration" report. [ERROR] VM #displayTree: error : too few arguments to macro. Wanted 2 got 0 [ERROR] VM #menuItem: error : too few arguments to macro. Wanted 1 got 0 [INFO] Generate "Dependencies" report. [INFO] Generate "Issue Tracking" report. [INFO] Generate "Project License" report. [INFO] Generate "Mailing Lists" report. [INFO] Generate "About" report. [INFO] Generate "Project Summary" report. [INFO] Generate "Source Repository" report. [INFO] Generate "Project Team" report. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 minutes 24 seconds [INFO] Finished at: Wed May 24 01:19:30 JST 2006 [INFO] Final Memory: 10M/21M [INFO] ------------------------------------------------------------------------
C:\apps\helloMaven>tree /F フォルダ パスの一覧: ボリューム IBM_PRELOAD ボリューム シリアル番号は 0000A0DD 40F6:CC2B です C:. │ pom.xml │ ├─src │ ├─main │ │ └─java │ │ └─com │ │ └─snail │ │ └─hello │ │ App.java │ │ │ └─test │ └─java │ └─com │ └─snail │ └─hello │ AppTest.java │ └─target │ exported-pom.xml │ helloMaven-1.0-SNAPSHOT.jar │ ├─classes │ └─com │ └─snail │ └─hello │ App.class │ ├─site │ │ dependencies.html │ │ index.html │ │ integration.html │ │ issue-tracking.html │ │ license.html │ │ mail-lists.html │ │ project-info.html │ │ project-summary.html │ │ source-repository.html │ │ team-list.html │ │ │ ├─css │ │ maven-base.css │ │ maven-theme.css │ │ print.css │ │ │ └─images │ │ collapsed.gif │ │ expanded.gif │ │ external.png │ │ icon_error_sml.gif │ │ icon_info_sml.gif │ │ icon_success_sml.gif │ │ icon_warning_sml.gif │ │ newwindow.png │ │ │ └─logos │ maven-feather.png │ ├─surefire-reports │ com.snail.hello.AppTest.txt │ TEST-com.snail.hello.AppTest.xml │ └─test-classes └─com └─snail └─hello AppTest.class
C:\apps\helloMaven>mvn clean