常见错误:
一..在eclipse导入已存在工作空间的项目,出现
情况1:
scanning errors (1):
1 could not read pom.xml
就是pom.xml出现了不能解析的配置,把不能解析的配置修改过来.例如去掉
<build>
<finalname>testweb</finalname>
</build>
情况2:
no marketplace entries found to handle maven-compiler-plugin:2.3.2:testcompile in eclipse.
将eclipse内置的maven换成外部自己安装的maven,重启eclipse.然后,在命令行执行mvn clean install再导入项目.
二.导入项目后出现:
project configuration is not up-to-date with pom.xml. run maven->update project or use quick fix.
在problems view的出错提示右键选quick fix,再按提示确定就ok.或者,右键项目->maven->update project
javaserver faces 2.2 can not be installed : one or more constraints have not been satisfied.
javaserver faces 2.2 requires dynamic web module 2.5 or newer.
先改web.xmlwebapp节点:
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
然后关闭eclipse,改项目下的.settings\org.eclipse.wst.common.project.facet.core.xml.将版本改成为3.1,将成后是<installed facet="jst.web" version="3.1"/>,再启动eclipse.最后出现上面的情况1,按上面更新下配置就ok.
三.<addmavendescriptor>false</addmavendescriptor>在eclipse无效,仍然会将pom.xml,pom.properties打包入jar.
在cli(command-line interface)运行命令,此种情况拒绝使用eclipse来执行命令(当然你测试打包入去没影响)
maven的5种scope对于3种class是否有效:
compile test runtime example
compile y y y spring-core
test - y - junit
provided y y - servlet-api
runtime - y y jdbc驱动
system y y - 本地的,maven仓库之外的类库文件
左边为第一直接依赖,上边为第二直接依赖,则对应的依赖传递如下:
compile test provided runtime
compile compile - - runtime
test test - - test
provided provided - provided provided
runtime runtime - - runtime
依赖调解两原则:
1.路径最近者优先
2.路径长度相同,解析依赖声明靠前优先