java - mvn install 在 eclipse 中不起作用,但在命令行中工作正常

标签 java eclipse spring maven

我无法通过 eclipse 构建项目,但当我运行 mvn clean install 时它工作正常。我遇到以下问题。

Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project abc-xxx: Execution default-
install of goal org.apache.maven.plugins:maven-install-plugin:2.4:install 
failed: Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its 
dependencies could not be resolved: Failed to collect dependencies at 
org.apache.maven.plugins:maven-install-plugin:jar:2.4 -> 
org.codehaus.plexus:plexus-utils:jar:3.0.5: Failed to read artifact descriptor 
for org.codehaus.plexus:plexus-utils:jar:3.0.5: Could not transfer artifact 
org.codehaus.plexus:plexus-utils:pom:3.0.5 from/to anonymous 
(https://nexus.xxx.xxx.xxx/nexus/content/groups/xxx):     
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: 
unable to find valid  certification path to requested target

最佳答案

确保您在命令行中使用的JDK与您在IDE中使用的相同。

在命令行中输入:

java -version

然后在 eclipse 中:

 windows -> preferences -> Installed JREs
<小时/>

对于ma​​ven也是如此:

在命令行中输入:

mvn -version

在 eclipse 中:

 windows -> preferences -> Maven -> User settings
 windows -> preferences -> Maven -> Installations

关于java - mvn install 在 eclipse 中不起作用,但在命令行中工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28441001/

相关文章:

java - 验证请求正文中的日期

Java 12 Shell 无法在 Windows 上正确读取键盘输入

java - JTabbedPane - 带有关闭按钮引用的选项卡

java - Eclipse 中的 Tomcat : It runs but time out during startup anyway

java - 使用 Neo 时出现问题

java - 如何使 Controller 端点在 java spring 中获取两个不同的对象?

java - 为什么我不能在 JBoss 上的 Solr 中实例化 DataImportHandler?

java - weblogic在运行时更改数据源

eclipse - 在 Eclipse 中设置窗口背景 JavaDoc

spring - ThymeLeaf - 将表数据(ArrayList)发布到另一个 Controller