パスワードを忘れた? アカウント作成
432561 journal

shimashimaの日記: [Java][Click][maven]maven jetty plugin + Click Framework

日記 by shimashima

Eclipse + maven + Click Framework + maven jetty plugin を利用する際のお勧め設定。

artifactIdが「click」の場合、通常は、

      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.9</version>
        <configuration>
          <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
              <port>8888</port>
              <maxIdleTime>30000</maxIdleTime>
            </connector>
          </connectors>
          <classesDirectory>${project.build.directory}/classes</classesDirectory>
          <webAppSourceDirectory>${project.build.directory}/click</webAppSourceDirectory>
          <contextPath>/</contextPath>
        </configuration>
      </plugin>

とするが、

      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.9</version>
        <configuration>
          <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
              <port>8888</port>
              <maxIdleTime>30000</maxIdleTime>
            </connector>
          </connectors>
          <classesDirectory>${project.build.directory}/classes</classesDirectory>
          <webAppSourceDirectory>${project.basedir}/src/main/webapp</webAppSourceDirectory>
          <contextPath>/</contextPath>
        </configuration>
      </plugin>

のようにすることでVelocity Templateの更新が即時反映されるので便利。

最初の設定のままだと

> mvn war:exploded

としないと target/[articfactId]/webapp/ 配下に src/main/webapp 配下のファイルがコピーされないため、Jettyから更新が見えないままとなる。修正後はJettyが直接 src/main/webapp を見に行くため、Eclipseで修正したVelocity Templateが即時に反映されるようになる。

mavenは依存関係の解決方法としては楽だが、Eclipseを含めえWebアプリケーションを開発する際にはいろいろと不都合がでてくる気がする。どうしたものか。

この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

未知のハックに一心不乱に取り組んだ結果、私は自然の法則を変えてしまった -- あるハッカー

読み込み中...