接触maven快2年了吧,对maven还是一知半解其实。得到了一些教训,就是少转牛角尖,多把握实际需要的东西,一口一口吃饭。
插件化很常见了。这里记录idea使用的jetty插件 和tomcat插件和编译插件:
<build> <plugins> <!-- 编译插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> </configuration> </plugin> <!-- tomcat 插件 --> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <port>8080</port> <path>/stickStory</path> </configuration> </plugin> <!-- jettyt 插件 --> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.3.7.v20160115</version> <configuration> <httpConnector> <port>8080</port> <host>localhost</host> </httpConnector> <webApp> <contextPath>/spring4webSocket</contextPath> </webApp> </configuration> </plugin> </plugins> </build>
插件配置学会去看官方文档,比如jetty那个插件配置文档在:https://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html