1. 程式人生 > >IDEA maven Run Maven 啟動方式

IDEA maven Run Maven 啟動方式

首先想要使用 Run Maven 啟動需要在IDEA設定裡找到plugins  在plugins視窗下面找到Browse Repositories  開啟Browse Repositories  下載完會叫你重啟IDEA 重啟前別忘了應用儲存重啟完別忘了配置,首先找到你們的maven安裝包apache-maven-3.5.4-bin\apache-maven-3.5.4\conf一般都會在conf裡面有個setting.xml檔案,可以在網上下載個Notepad++開啟這個檔案,開啟後找到<pluginGroups>標籤在這個裡面配置<pluginGroups><pluginGroup>org.mortbay.jetty</pluginGroup></pluginGroups>這段程式碼

就是這樣的 退出前別忘了儲存,然後開啟IDEA 在pom.xml裡找到<plugins>標籤下配置

<plugin>    <groupId>org.mortbay.jetty</groupId>    <artifactId>jetty-maven-plugin</artifactId>    <configuration>        <webApp>            <contextPath>/</contextPath>        </webApp>        <stopKey>webx</stopKey>        <stopPort>9999</stopPort>        <connectors>            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">                <port>8088</port>                <maxIdleTime>60000</maxIdleTime>            </connector>        </connectors>        <requestLog implementation="org.eclipse.jetty.server.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>${productionMode}</value>            </systemProperty>        </systemProperties>    </configuration></plugin>

這句程式碼        再就是配置maven這個地方

jetty:run -Djetty.port=8088 一定加上這條命令

IDEA在專案上右鍵沒有出現 Run Maven 需要下載Maven Helper外掛   還是在設定裡找到 plugins  在plugins 視窗下面找到 Browse Repositories  下載完會重啟IDEA 重啟前別忘了應用儲存。

執行專案前先在根專案包右鍵 Run Maven 裡找到 clean install就OK了