项目启动报错
最近在学习的时候,使用Tomcat插件来启动Maven,总有时候启动不了,提示Maven依赖找不到。所以决定好好记录这个问题。
问题描述
下面是使用Tomcat启动的时候的报错
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ epoint-jgzl-web >>>
[INFO] Downloading from epoint-nexus: http://192.168.0.99:8081/nexus/content/groups/public/e-iceblue/spire.pdf/5.4.0/spire.pdf-5.4.0.pom
[WARNING] The POM for com.epoint:gmhelper:jar:0.0.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.alibaba:druid:jar:1.1.21.e2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.564 s
[INFO] Finished at: 2022-12-06T15:38:01+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project epoint-jgzl-web: Could not resolve dependencies for project com.epoint.ipm:epoint-jgzl-web:war:2.0.0:
Failed to collect dependencies at com.epoint.ipm:epoint-jgzl-action:jar:2.0.0
-> com.epoint.ipm:epoint-jgzl-api:jar:2.0.0 -> com.epoint.ipm:epoint-jgzl-common:jar:2.0.0
-> e-iceblue:spire.pdf:jar:5.4.0:
Failed to read artifact descriptor for e-iceblue:spire.pdf:jar:5.4.0: Could not transfer
artifact e-iceblue:spire.pdf:pom:5.4.0 from/to epoint-nexus (http://192.168.0.99:8081/nexus/content/groups/public/):
Transfer failed for http://192.168.0.99:8081/nexus/content/groups/public/e-iceblue/spire.pdf/5.4.0/spire.pdf-5.4.0.pom:
Connect to 192.168.0.99:8081 [/192.168.0.99] failed: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
十二月 06, 2022 3:37:31 下午 java.util.prefs.WindowsPreferences <init>
警告: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
原因分析
原因可能是我们,在使用eclipse导入Maven工程,没有Maven update更新构建解析工程,让一些依赖相互引用或者是可能我们在使用Tomcat插件启动项目的时候,没有勾选相关的选项
解决方案:
首先,我们可以使用eclipse中的Maven插件,选中工程进行Maven clean清楚依赖,然后再Maven install下载回来依赖
然后,就是选中所有的工程进行,Maven update重新构建Maven工程
最后,我们在使用Tomcat插件启动项目的时候,进行配置一下添加解析的工程文件,然后再启动