Webアプリの作成

[追記] archetype:create は、Maven 3.0.5 で廃止

kagyuu@SNAIL /cygdrive/c/Documents and Settings/kagyuu/workspace
$ mvn archetype:generate -DgroupId=com.snail.helloWeb -DartifactId=helloWeb -DarchetypeArtifactId=maven-archetype-webapp
[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.properties
[INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[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 r
esource 'VM_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  global in scope if allowed.
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] [archetype:create]
[INFO] Defaulting package to group ID: com.snail.helloWeb
[INFO] artifact org.apache.maven.archetypes:maven-archetype-webapp: checking for updates from central
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating Archetype: maven-archetype-webapp:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.snail.helloWeb
[INFO] Parameter: packageName, Value: com.snail.helloWeb
[INFO] Parameter: package, Value: com.snail.helloWeb
[INFO] Parameter: artifactId, Value: helloWeb
[INFO] Parameter: basedir, Value: c:\Documents and Settings\kagyuu\workspace
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] ********************* End of debug info from resources from generated POM ***********************
[INFO] Archetype created in dir: c:\Documents and Settings\kagyuu\workspace\helloWeb
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Thu Feb 08 01:39:57 JST 2007
[INFO] Final Memory: 5M/9M
[INFO] ------------------------------------------------------------------------//----------------------------------------------------

WTP向けの設定ファイルの作成

kagyuu@SNAIL /cygdrive/c/Documents and Settings/kagyuu/workspace
$  cd helloWeb/

kagyuu@SNAIL /cygdrive/c/Documents and Settings/kagyuu/workspace/helloWeb
$ mkdir src/main/java

kagyuu@SNAIL /cygdrive/c/Documents and Settings/kagyuu/workspace/helloWeb
$ mvn eclipse:eclipse -Dwtpversion=1.0 -DdownloadSources=true
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'eclipse'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building helloWeb Maven Webapp
[INFO]    task-segment: [eclipse:eclipse]
[INFO] ----------------------------------------------------------------------------
[INFO] Preparing eclipse:eclipse
[INFO] No goals needed for project - skipping
[INFO] [eclipse:eclipse]
[INFO] Adding support for WTP version 1.0.
[INFO] Using source status cache: c:\Documents and Settings\kagyuu\workspace\helloWeb\target\mvn-eclipse-cache.properties
[INFO] Not writing settings - defaults suffice
[INFO] File c:\Documents and Settings\kagyuu\workspace\helloWeb\.project already exists.
       Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed.
[INFO] Wrote Eclipse project for "helloWeb" to c:\Documents and Settings\kagyuu\workspace\helloWeb.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Feb 08 01:41:44 JST 2007
[INFO] Final Memory: 3M/7M
[INFO] -----------------------------------------------------------------------

WTPへのインポート

  1. Eclipse上で資産のインポートを選択します
    mavenEclipse1.png
  2. 既存のプロジェクト(さっき作ったMavenプロジェクト)をインポートします
    mavenEclipse2.png
  3. 適当に選んで終了
    mavenEclipse3.png
  4. インポート直後はコンパイルエラーが出てきます
    mavenEclipse4.png
  5. Maven2プラグインを有効化します
    mavenEclipse5.png
  6. [Source Folder Update]を選択します。(コンパイルエラーを消すためのおまじない)
    mavenEclipse6.png
  7. コンパイルエラーが消えました
    mavenEclipse7.png

Warファイルの作成(Mavenの実行)

  1. 外部ツールを選択します
    execMaven1.png
  2. 新しいMavenプロジェクトを作成します。goal は、とりあえず package (warファイルの作成)
    execMaven2.png
  3. 「実行」ボタンを押すと、Maven が実行されました.
    execMaven3.png

開発環境(WTP-JBOSS)内での実行

  1. プロジェクトを右クリックして、[実行]-[Run on Server] を選択します
    WebappExec1.png
  2. JBOSSサーバを選択し
    WebappExec2.png
  3. warファイルを追加します
    WebappExec3.png
  4. [終了]を押すと、warファイルがdeploy(配備)されて実行されます
    WebAppExec4.png

Java#JavaEE / Java Maven


添付ファイル: filemavenEclipse6.png 2443件 [詳細] fileexecMaven1.png 2475件 [詳細] filemavenEclipse1.png 2485件 [詳細] fileWebappExec3.png 2458件 [詳細] fileWebAppExec4.png 2413件 [詳細] fileWebappExec2.png 2457件 [詳細] fileexecMaven3.png 2457件 [詳細] filemavenEclipse4.png 2395件 [詳細] fileWebappExec1.png 2416件 [詳細] filemavenEclipse3.png 2437件 [詳細] filemavenEclipse2.png 2565件 [詳細] filemavenEclipse7.png 2553件 [詳細] filemavenEclipse5.png 2416件 [詳細] fileexecMaven2.png 2342件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2007-03-10 (土) 22:53:11 (6501d)
Short-URL: http://at-sushi.com/pukiwiki/index.php?cmd=s&k=39a681e326
ISBN10
ISBN13
9784061426061