WEBX3學習-eclipse下導入並運行webx(maven)工程

        作爲java開發工程師,相信大多數人都會使用eclipse開發,所以我們將webx工程導入到eclipse中,在WEBX3學習-1分鐘構建WEBX簡單應用中我們已經生成了tutorial1項目工程,下面就開始導入吧。

一、eclipse導入webx(maven)工程

        1、在WEBX3學習-Maven及m2eclipse安裝中我們已經安裝了m2eclipse,選擇File – Import – Maven – Maven Project(如果是myeclipse,安裝的插件是Maven4MyEclipse,路徑是File – Import – Maven4MyEclipse – Existing Maven Project),如圖:

       2、然後點擊Next,就會出現Import Projects對話框,在該對話框中點擊Browse…選擇d:\temp\tutorial1目錄(即包含pom.xml文件的那個目錄),這時對話框中的Projects:部分就會顯示該目錄包含的Maven項目如圖:


          3、點擊Finish之後,m2ecilpse就會將該項目導入到當前的workspace中,導入完成之後,我們就可以在Package Explorer視圖中看到項目目錄,如圖:


二、eclipse下運行webx(maven)工程

        1、現在webx(maven)工程已經導入,並且在webx的骨架工程的pom.xml中已經加入了jetty的plugin信息,所以就不需要自己增加了,如下:

         <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <configuration>
                    <contextPath>/</contextPath>
                    <connectors>
                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                            <port>8081</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                    <requestLog implementation="org.mortbay.jetty.NCSARequestLog">
                        <filename>target/access.log</filename>
                        <retainDays>90</retainDays>
                        <append>false</append>
                        <extended>false</extended>
                        <logTimeZone>GMT+8:00</logTimeZone>
                    </requestLog>
                    <systemProperties>
                        <systemProperty>
                            <name>productionMode</name>
                            <value>false</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>

        2、在webx工程上,點擊右鍵,點擊Run As -- Run Configurations,如圖:

        3、Base directory中選擇工程:tutorial1,Goals中填入:jetty:run,然後點擊Run,就可以運行了,等到jetty server啓動之後,請在瀏覽器地址欄輸入地址,或直接點擊這個鏈接:http://localhost:8081/。你應該可以看到類似下面的結果:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章