這不能算是一個(gè)bug,是我太笨了。
昨天從github上面copy了一個(gè)項(xiàng)目準(zhǔn)備到本地運(yùn)行。導(dǎo)入該maven項(xiàng)目到eclipse中后,熟練的把項(xiàng)目加入tomcat,啟動(dòng)tomcat運(yùn)行。訪問發(fā)現(xiàn)首頁有了,但樣式都沒了,也不能跳轉(zhuǎn)到任何地方。
第一想到就是是不是靜態(tài)資源都被攔截了,看了看發(fā)現(xiàn)有相關(guān)的配置。搞得我反反復(fù)復(fù)import了好多次,最后我打算看看他的pom.xml文件,發(fā)現(xiàn)配置了這么一段
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<port>8071</port>
<uriEncoding>UTF-8</uriEncoding>
<contextReloadable>true</contextReloadable>
</configuration>
</plugin>
坑爹了啊,恍然大悟啊,這樣應(yīng)該是不能直接加入tomcat運(yùn)行。于是我這樣運(yùn)行

13.png

14.png
果然沒報(bào)錯(cuò)了。