添加两行配置:
<ignorePackaging>true</ignorePackaging>
<additionalClasspathDirs>
<additionalClasspathDir>${project.build.directory}/classes</additionalClasspathDir>
</additionalClasspathDirs>
build配置如下
<build>
<finalName>boss</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<port>8080</port>
<uriEncoding>UTF-8</uriEncoding>
<url>http://localhost:8080/</url>
<server>tomcat7</server>
<ignorePackaging>true</ignorePackaging>
<additionalClasspathDirs>
<additionalClasspathDir>${project.build.directory}/classes</additionalClasspathDir>
</additionalClasspathDirs>
</configuration>
</plugin>
</plugins>
</build>