1. Add the plugin, modify the version on the line
<plugin><span style= "White-space:pre" ></span><groupid>org.apache.maven.plugins</ Groupid><span style= "White-space:pre" ></span><artifactid>maven-compiler-plugin</ Artifactid><span style= "White-space:pre" ></span><version>3.3</version><span style= "White-space:pre" ></span><configuration><span style= "White-space:pre" ></span>< Source>1.7</source><span style= "White-space:pre" ></span><target>1.7</target> <span style= "White-space:pre" ></span></configuration><span style= "White-space:pre" ></ Span></plugin>
Project needs to be refreshed, followed by records
2. Run the package:
[INFO] Scanning for projects ... [INFO] [INFO]------------------------------------------------------------------------[INFO] Building WebTest Maven Webapp 0.0.1-snapshot[info]------------------------------------------------------------------------[WARNING] The Artifact servletapi:servletapi:jar:2.4 have been relocated to Javax.servlet:servlet-api:jar:2.4[info] [INFO]--- Maven-resources-plugin:2.6:resources (default-resources) @ WebTest---[WARNING] Using platform encoding (UTF-8 actually To copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 Resource[info] [INFO]---maven-compiler-plugin:3.3:compile (default-compile) @ WebTest---[info] changes Detec Ted-recompiling the module! [WARNING] File encoding have not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to D:\all\eclipse432\webtest\target\classes[info] [INFO]---MAVEN-RESOURCES-PLUgin:2.6:testresources (default-testresources) @ WebTest---[WARNING] Using platform encoding (UTF-8 actually) to copy fil tered resources, i.e. build is platform dependent! [INFO] Skip non existing resourcedirectory d:\all\eclipse432\webtest\src\test\resources[info] [INFO]--- Maven-compiler-plugin:3.3:testcompile (default-testcompile) @ WebTest---[INFO] nothing to Compile-all classes is up to Date[info] [INFO]---maven-surefire-plugin:2.12.4:test (default-test) @ WebTest---[info] [INFO]---Maven-war-plugin:2 .2:war (Default-war) @ WebTest---[INFO] packaging Webapp[info] Assembling WebApp [WebTest] in [D:\all\eclipse432\WebTest \target\webtest][info] processing war Project[info] Copying webapp resources [D:\all\eclipse432\WebTest\src\main\ Webapp][info] WebApp assembled in [Msecs][info] Building War:d:\all\eclipse432\webtest\target\webtest.war[info] Web-inf\web.xml already added, Skipping[info]-------------------------------------------------------------------- ----[INFO] BUILD Success[info]------------------------------------------------------------------------[INFO] Total time:2.818 s[ INFO] finished at:2016-05-11t02:34:46+08:00[info] Final Memory:16m/167m[info]------------------------------------- -----------------------------------
3. Complete POM Record:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" ><modelversion >4.0.0</modelversion><groupid>org.ms.bop</groupid><artifactid>webtest</ Artifactid><packaging>war</packaging><version>0.0.1-snapshot</version><name> WebTest Maven webapp</name><url>http://maven.apache.org</url><dependencies>< Dependency><groupid>junit</groupid><artifactid>junit</artifactid><version> 3.8.1</version><scope>test</scope></dependency><dependency><groupid> Servletapi</groupid><artifactid>servletapi</artifactid><version>2.4</version> <scope>provided</scope></dependency><dependency><groupid>javax.servlet.jsp</ Groupid><artifactid>jsp-api</artifactid><version>2.2</version><scope>provided</scope></dependency><! --<dependency> <groupId>org.eclipse.jetty</groupId> <artifactid>jetty-maven-plugin</ Artifactid> </dependency>--></dependencies><build><finalname>webtest</ finalname><plugins><plugin><groupid>org.apache.maven.plugins</groupid>< Artifactid>maven-compiler-plugin</artifactid><version>3.3</version><configuration> <source>1.7</source><target>1.7</target></configuration></plugin><!-- <plugin> <groupId>org.mortbay.jetty</groupId> <artifactid>jetty-maven-plugin</ artifactid> <version>8.1.16.v20140903</version> <configuration> <scanintervalseconds>5 </scanIntervalSeconds> <webApp> <contextPath>/WebTest</contextPath> </webApp> </ Configuration> </pLugin>--></plugins></build></project>
MAVEN Learning 16 specifying the JDK version