close

  晚上游完泳,NB放公司,家裡用PC,把Eclipse該掛的plugin掛上。爭議最大的還是M2Eclipse。一樣還是用Struts2作為練習,結果發現M2Eclipse提供的archtype清單把struts2 archtype starter拿掉了。M2Eclipse還是有保留[Add Archtype]按鈕的功能,變成要手動加上去。M2Eclipse現在是0.10.0版,估計出現1.0版可能要收錢了。

  過程中想到M2Eclipse以外的替代品,結果只適合Maven 1.x版。倒是找到如何在M2Eclipse 0.10.0自訂Maven Build另一個方式,一樣以mvn jetty:run為例,我參考這個網址:http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin,在pom.xml的<build>/<plugins>下加了這麼一段:

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
</plugin>

  結果在Eclipse目錄(不是workspace)的plugins子目錄下,下載了org.mortbay.jetty.server_6.1.15.v200905151201.jar和org.mortbay.jetty.util_6.1.15.v200905182336.jar。之後到別的Maven Project的pom.xml不必再設定上述的plugin。直接在pom.xml做好如下設定,就可以Eclipse裡用M2Eclipse去執行自訂Maven build:mvn jetty:run。雖然Goals欄位旁的[Select]還是不能去選Goal。

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.5</version>
    <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
    </configuration>
</plugin>

  真奇怪還是辨不明白,jetty-maven-plugin和maven-jetty-plugin差在何處?為何前者會update到Eclipse主目錄下的plugins,後者是update到workspace下的plugins。
arrow
arrow
    全站熱搜

    Jemmy 發表在 痞客邦 留言(0) 人氣()