Wicketサンプルプロジェクトの作成

http://wicket.apache.org/quickstart.htmlを参考に、Wicketサンプルプロジェクトを作成します。
プロジェクト名は、次になります。

  • Groupid: com.example
  • ArtifactId: myproject
  • Version: 1.4.6
$ # プロジェクトを作成するEclipse Workspaceディレクトリに移動
$ cd ~/Documents/workspace

$ # Wicketサンプルプロジェクトの作成
$ mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.4.6 -DgroupId=com.example -DartifactId=myproject
... (中略) ...
[INFO] BUILD SUCCESSFUL

$ # プロジェクトディレクトリに移動
$ cd myproject/

$ # プロジェクトの実行
$ mvn jetty:run

Webブラウザから、http://localhost:8080/myproject/ にアクセスして、

Wicket Quickstart Archetype Homepage

If you see this message wicket is properly configured and running

が表示されればOK。

Eclipseでの使用

Eclipseのクラスパス変数: "M2_REPO" を設定します。

$ mvn -Declipse.workspace=${eclipse.workspace.fullpath} eclipse:add-maven-repo
... (中略) ...
[INFO] BUILD SUCCESSFUL
カスタマイズ(必要なければ、スキップ)
$ vi pom.xml
>>
    <build>
        <resources>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/resources</directory>
            </resource>
            <!-- htmlファイルを格納する別ディレクトリを指定 -->
            <resource>
                <filtering>false</filtering>
                <directory>src/main/html</directory>
                <includes>
                    <include>**/*.html</include>
                </includes>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/java</directory>
                <includes>
                    <include>**</include>
                </includes>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
....
        <plugins>
            <plugin>
                <inherited>true</inherited>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <!-- JDK 1.6 としてコンパイル -->
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <optimize>true</optimize>
                    <debug>true</debug>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <classpathContainers>
                      <!-- default JDK(1.6) を指定 -->
                      <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
                    </classpathContainers>
                    <buildcommands>
                      <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
                      <!-- checkstyle plugin add -->
                      <buildcommand>net.sf.eclipsecs.core.CheckstyleBuilder</buildcommand>
                    </buildcommands>
                    <projectnatures>
                      <projectnature>org.eclipse.jdt.core.javanature</projectnature>
                      <projectnature>net.sf.eclipsecs.core.CheckstyleNature</projectnature>
                    </projectnatures>
                </configuration>
            </plugin>
....
<<
$ # Eclipse プロジェクトファイルを作成
$ mvn eclipse:eclipse -DdownloadSources=true
... (中略) ...
[INFO] BUILD SUCCESSFUL

Eclipseを起動します。
Eclipseから既存プロジェクトのインポートを実行します。