mvn install 在 eclipse 中不工作,但在命令行中工作正常

mvn install is not working in eclipse but works fine from command line

我无法通过 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[ 中使用的相同=31=].

在命令行中输入:

java -version

然后在 eclipse 中:

 windows -> preferences -> Installed JREs

同样适用于maven:

在命令行中输入:

mvn -version

日食中:

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