- 追加された行はこの色です。
- 削除された行はこの色です。
// 一覧用テンプレート
#topicpath
----
#contents
MavenはApacheが開発しているプロダクト管理ツール(?)です。Antの用にビルドしたり、プロジェクト用のサイトを作成したり、JavaDocを作成したり、JUnitを実行したりできる何でもありツールですね。
**Install [#bdd2b7dd]
http://maven.apache.org/download.html よりダウンロードし、適当なところに解凍しておけば完了です。パスを通しておけば完璧です。
**基本 [#u6245c00]
***プロジェクトを作る [#ud640ad4]
まずはプロジェクトの作り方です。
mvn archetype:create -DgroupId=nu.mine.kino.mavensample -DartifactId=kino-app
で、以下のプロジェクト構成ができあがります。
bash-3.2$ pwd
/cygdrive/t/workspace3.2
bash-3.2$ mvn archetype:create -DgroupId=nu.mine.kino.mavensample -DartifactId=
kino-app
[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] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus
.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] **************************************************************
[INFO] Starting Jakarta Velocity v1.4
[INFO] RuntimeInstance initializing.
[INFO] Default Properties File: org\apache\velocity\runtime\defaults\velocity.pr
operties
[INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.
resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLo
aderResourceLoader
[INFO] ClasspathResourceLoader : initialization starting.
[INFO] ClasspathResourceLoader : initialization complete.
[INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.
ResourceCacheImpl)
[INFO] Default ResourceManager initialization complete.
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[INFO] Created: 20 parsers.
[INFO] Velocimacro : initialization starting.
[INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
[ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any
resource loader.
[INFO] Velocimacro : error using VM library template VM_global_library.vm : org
.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'V
M_global_library.vm'
[INFO] Velocimacro : VM library template macro registration complete.
[INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
[INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT
replace previous VM definitions
[INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be glob
al in scope if allowed.
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] [archetype:create]
[INFO] Defaulting package to group ID: nu.mine.kino.mavensample
[INFO] artifact org.apache.maven.archetypes:maven-archetype-quickstart: checking
for updates from central
[INFO] -------------------------------------------------------------------------
---
[INFO] Using following parameters for creating Archetype: maven-archetype-quicks
tart:RELEASE
[INFO] -------------------------------------------------------------------------
---
[INFO] Parameter: groupId, Value: nu.mine.kino.mavensample
[INFO] Parameter: packageName, Value: nu.mine.kino.mavensample
[INFO] Parameter: basedir, Value: T:\workspace3.2
[INFO] Parameter: package, Value: nu.mine.kino.mavensample
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: artifactId, Value: kino-app
[INFO] ********************* End of debug info from resources from generated POM
***********************
[INFO] Archetype created in dir: T:\workspace3.2\kino-app
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Fri Jun 22 00:02:38 JST 2007
[INFO] Final Memory: 4M/8M
[INFO] ------------------------------------------------------------------------
bash-3.2$ ls -lrt kino-app
total 1
-rwx------+ 1 m-kino mkgroup 653 Jun 22 00:02 pom.xml <-プロジェクトの設定ファイル
drwx------+ 4 m-kino mkgroup 0 Jun 22 00:02 src
bash-3.2$
***コンパイルする [#w41efd4f]
コンパイルするにはプロジェクトのディレクトリに移動して、
bash-3.2$ mvn compile
でOK.
bash-3.2$ ls -lrt kino-app
total 1
-rwx------+ 1 m-kino mkgroup 653 Jun 22 00:02 pom.xml
drwx------+ 4 m-kino mkgroup 0 Jun 22 00:02 src
bash-3.2$ cd kino-app/
bash-3.2$ pwd
/cygdrive/t/workspace3.2/kino-app
bash-3.2$ mvn compile
[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------------
---
[INFO] Building kino-app
[INFO] task-segment: [compile]
[INFO] -------------------------------------------------------------------------
---
[INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for up
dates from central
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resour
ces-plugin/2.2/maven-resources-plugin-2.2.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugin
s/1/maven-plugins-1.pom
3K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resour
ces-plugin/2.2/maven-resources-plugin-2.2.jar
13K downloaded
[INFO] artifact org.apache.maven.plugins:maven-compiler-plugin: checking for upd
ates from central
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compil
er-plugin/2.0.2/maven-compiler-plugin-2.0.2.pom
2K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugin
s/8/maven-plugins-8.pom
5K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/5/maven
-parent-5.pom
14K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/apache/3/apache-3.pom
3K downloaded
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compil
er-plugin/2.0.2/maven-compiler-plugin-2.0.2.jar
17K downloaded
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-m
anager/1.5.3/plexus-compiler-manager-1.5.3.pom
634b downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1
.5.3/plexus-compiler-1.5.3.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components
/1.1.6/plexus-components-1.1.6.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/1.0.8/plex
us-1.0.8.pom
7K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-a
pi/1.5.3/plexus-compiler-api-1.5.3.pom
624b downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-j
avac/1.5.3/plexus-compiler-javac-1.5.3.pom
797b downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compilers/
1.5.3/plexus-compilers-1.5.3.pom
7K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.0.
5/plexus-utils-1.0.5.pom
918b downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-a
pi/1.5.3/plexus-compiler-api-1.5.3.jar
19K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-j
avac/1.5.3/plexus-compiler-javac-1.5.3.jar
13K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.0.
4/plexus-utils-1.0.4.jar
159K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-m
anager/1.5.3/plexus-compiler-manager-1.5.3.jar
5K downloaded
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to t:\workspace3.2\kino-app\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24 seconds
[INFO] Finished at: Fri Jun 22 00:07:34 JST 2007
[INFO] Final Memory: 2M/8M
[INFO] ------------------------------------------------------------------------
bash-3.2$
Mavenは
mvn compile
など、Antでいうタスクのようなモノを引数に起動すると、そのタスクに必要なライブラリをネット上のリポジトリから勝手にダウンロードしてきてキャッシュし、それを使用します。上の例だと
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-m
anager/1.5.3/plexus-compiler-manager-1.5.3.jar
とかやってるわけですね。
コンパイルが完了すると target というディレクトリの中にコンパイルされてクラスファイルが入ってました。
***コンテンツ一覧 [#j6c2bfbc]
**コンテンツ一覧 [#j6c2bfbc]
#ls2
***関連リンク [#gc0871b8]
**関連リンク [#gc0871b8]
-[[Welcome to Maven>http://maven.apache.org/]]
-[[pom.xml>http://www.limy.org/program/java/maven/project.html]]
-[[Maven プロジェクトレポートの作成>http://hondou.homedns.org/pukiwiki/pukiwiki.php?cmd=read&page=Maven%20%A5%D7%A5%ED%A5%B8%A5%A7%A5%AF%A5%C8%A5%EC%A5%DD%A1%BC%A5%C8%A4%CE%BA%EE%C0%AE&word=Maven#n7b527a4]]
-[[デフォルトのリポジトリ>http://repo1.maven.org/maven2/]]
-[[Repository検索>http://mvnrepository.com/]]
-[[Maven-TECHSCORE->http://www.techscore.com/tech/ApacheJakarta/Maven/index.html]]
-[[An introduction to Maven 2>http://www.javaworld.com/javaworld/jw-12-2005/jw-1205-maven.html?page=3]]
-[[Maven2のTipsを集めるWiki>http://wiki.fdiary.net/maven2/?CookBook#l4]]
-[[Maven Eclipseとの連携>http://hondou.homedns.org/pukiwiki/pukiwiki.php?Maven%20Eclipse%A4%C8%A4%CE%CF%A2%B7%C8]]
-[[[Maven2]依存Jarをローカルリポジトリに追加する>http://72.14.235.104/search?q=cache:GPA3Hd7qYD8J:hpcgi2.nifty.com/wutse/wifky/wifky.cgi%3Fp%3D%255BMaven2%255D%25B0%25CD%25C2%25B8Jar%25A4%25F2%25A5%25ED%25A1%25BC%25A5%25AB%25A5%25EB%25A5%25EA%25A5%25DD%25A5%25B8%25A5%25C8%25A5%25EA%25A4%25CB%25C4%25C9%25B2%25C3%25A4%25B9%25A4%25EB+Maven2+%E4%BE%9D%E5%AD%98&hl=ja&ct=clnk&cd=3&gl=jp&lr=lang_ja]]
-[[Available Plugins>http://maven.apache.org/plugins/index.html]]
-[[Mac OS X に maven3 (3.0.5) をインストールする手順 | OSCALOG>http://oscasierra.net/2013/05/install-maven-3-0-mac/]]
-[[scopeの記述の意味>http://www.techscore.com/tech/Java/ApacheJakarta/Maven/3/#maven-3-1-1]]
----
SIZE(10){[[FrontPage]]}~
SIZE(10){現在のアクセス:&counter;}