以下问题均为作者在构建Maven项目中遇到的错误。
①Maven: unable to create project from archetype
解决方法:cmd中执行(前提是maven已经配置环境变量):mvn archetype:generate
② No plugin found for prefix 'install' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (D:\eclipse\Repository), ibiblio (http://mirrors.ibiblio.org/maven2/)]
问题原因:(前提是修改过maven安装目录下的Settings.xml)本地的仓库中没有包含该jar,执行命令时使用的Settings.xml为maven安装目录下的Settings.xml,该Settings.xml中的本地仓库设置成了D:\eclipse\Repository,但在Eclipse中的Settings.xml设置的又是默认的.m2中的Settings.xml,而这个Settings.xml会将jar包下载到.m2下的Repository。所有在D:\eclipse\Repository中就根本不存在jar了。
解决方法:方法一.
将maven安装目录下的Settings.xml中的本地仓库去掉;方法二. 在Eclipse中的UserSettings修改为maven安装目录下的Settings.xml
③missing artifact com.oracle:ojdbc14:jar:10.2.0.2.0
解决方法:在http://pan.baidu.com/s/1hrJG0V6下载ojdbc14-10.2.0.2.0.jar将其手动添加到本地仓库在cmd中执行以下命令
mvn install:install-file -Dfile=jar包位置 -DgroupId=pom.xml依赖中的groupId -DartifactId=pom.xml依赖中的artifactId -Dversion=pom.xml依赖中的version -Dpackaging=jar
④Missing library: xdoclet-1.2.1.jar. Select the home directory for XDoclet. 1.2.1
解决方法:在http://pan.baidu.com/s/1eSkOO4i下载xdoclet-1.2.1.jar,解压后将Xdoclet home设置为该lib的路径