运行环境:

JDK 版本:1.8

Maven 版本:apache-maven-3.3.3

IDEA 版本:14

maven-jetty-plugin 配置:

<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<webAppSourceDirectory>${project.basedir}/web</webAppSourceDirectory>
<scanIntervalSeconds>10</scanIntervalSeconds>
<httpConnector>
<port>8081</port>
</httpConnector>
<stopKey>shutdown</stopKey>
<stopPort>9966</stopPort>
<webApp>
<contextPath>/${project.artifactId}</contextPath>
</webApp>
</configuration>
</plugin>

控制台输出异常信息:

"C:\Program Files\Java\jdk1.8.0_65\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59770,suspend=y,server=n -Dmaven.home=D:\apache-maven-3.3.3 -Dclassworlds.conf=D:\apache-maven-3.3.3\bin\m2.conf -Dfile.encoding=UTF-8 -classpath "D:\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.2\lib\idea_rt.jar" org.codehaus.classworlds.Launcher -Didea.version=14.0.2 jetty:run
Connected to the target VM, address: '127.0.0.1:59770', transport: 'socket'
Disconnected from the target VM, address: '127.0.0.1:59770', transport: 'socket'
-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.
Process finished with exit code 1

解决方法:

网上说是由于 IDEA 与 Maven 的版本不兼容造成的上述问题(原文地址:http://bbs.51cto.com/thread-1147659-1.html),把 Maven 改成 apache-maven-3.1.1-bin ,上述问题就成功解决了。

04-02 05:38
查看更多