插件org.apache.maven。插件:maven-compiler- compiler-plugin或其依赖项之一无法解决

时间:2023-01-25 12:40:42

I'm having some issues to configure properly my eclipse to work with maven.

我有一些问题需要正确配置我的eclipse,以便与maven一起工作。

I create a new project, this one is correctly build with maven in command line (mvn install), but in Eclipse I got this error:

我创建了一个新项目,这个项目是用maven在命令行(mvn安装)中正确构建的,但是在Eclipse中我得到了这个错误:

CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 (): ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-settings:jar:2.2.1: ArtifactResolutionException: Failure to transfer org.apache.maven:maven-settings:pom:2.2.1 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-settings:pom:2.2.1 from/to central : NullPointerException pom.xml /test line 9 Maven Project Build Lifecycle Mapping Problem

CoreException:无法获取用于插件执行default-compile的参数编译器的值:PluginResolutionException: plugin .apache -compile -plugin:3.1或它的一个依赖项无法解决:未能收集到对org.apache.maven.plugins的依赖项:maven-compile -plugin:jar:3.1 (): ArtifactDescriptorException:未能读取org.apache.maven的构件描述符:maven-settings:jar:2.2.1: ArtifactResolutionException:未能从http://repo.maven.apache.maven .maven:maven-settings:pom:2.2.1从http://repo.maven.apache.org/maven2缓存在本地存储库中,直到central的更新间隔被强制或更新,才会重新尝试解析。原始错误:无法传输工件组织。apache.maven:maven-settings:pom:2.2.1 from/to central: NullPointerException pom。xml /测试行9 Maven项目构建生命周期映射问题。

Here is my settings.xml conf :

这是我的设置。xml配置:

<proxy>
  <active>true</active>
  <protocol>http</protocol>
  <username>myuser</username>
  <password>$mymdp</password>
  <host>myhost</host>
  <port>8080</port>
  <nonProxyHosts>some.host.com</nonProxyHosts>
</proxy>
....

<repository>
     <id>central</id>
     <name>central repo m2</name>
     <url>http://central.maven.org/maven2</url>
</repository>

I choose the correct maven installation (in Preference -> Maven -> Install)

我选择正确的maven安装(首选-> maven ->安装)

I also direct my user settings on the correct settings.xml (Preferences -> Maven -> User Settings)

我还将用户设置指向正确的设置。xml(首选项-> Maven ->用户设置)

But I still got this error in Eclipse and everything goes well with maven command line. Do you have and idea?

但是我在Eclipse中仍然有这个错误,并且maven命令行运行得很好。你有什么想法吗?

4 个解决方案

#1


7  

Have you tried to remove the proxy username and password? A similar poster encountered that issue:

您是否试图删除代理用户名和密码?类似的海报也遇到了这个问题:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved

无法计算构建计划:插件org.apache. mavenins:maven-jar-plugin:2.3.2或其中一个依赖项无法解决

Failing that I found the following worked:

如果没有,我发现以下方法是有效的:

  1. Delete project in Eclipse (but do not delete the contents on disk)
  2. 在Eclipse中删除项目(但不删除磁盘上的内容)
  3. Delete all files in your Maven repository
  4. 删除Maven存储库中的所有文件
  5. Re-download all Maven dependencies:
  6. 重新下载所有Maven的依赖关系:

mvn dependency:resolve

mvn依赖性:解决

  1. Start up Eclipse
  2. 启动Eclipse
  3. Ensure that Eclipse is configured to use your external Maven installation (Window->Preferences->Maven->Installations)
  4. 确保将Eclipse配置为使用外部Maven安装(窗口->首选项->Maven->安装)
  5. Re-import the existing project(s) into Eclipse
  6. 将现有项目重新导入Eclipse。
  7. Ensure that there are no Maven Eclipse plugin errors on the final screen of the project import
  8. 确保在项目导入的最终屏幕上没有Maven Eclipse插件错误。

#2


5  

You only need to delete one folder it is throwing error for. Just go to your M2 repo and org/apache/maven/plugins/maven-compiler-plugins and delete the folder 2.3.2

您只需要删除它正在抛出错误的一个文件夹。只需进入M2 repo和org/apache/maven/plugins/maven-compiler-plugins并删除2.3.2文件夹

#3


1  

The issue has been resolved while installation of the maven settings is provided as External in Eclipse. The navigation settings are Window --> Preferences --> Installations. Select the External as installation Type, provide the Installation home and name and click on Finish. Finally select this as default installations.

当maven设置的安装作为Eclipse中的外部设置提供时,这个问题已经解决。导航设置是窗口——>首选项——>安装。选择外部作为安装类型,提供安装home和名称,然后单击Finish。最后选择这个作为默认安装。

#4


0  

I was getting this problem when using IBM RSA 9.6.1 when building a brand new development machine. The problem for me ended up being because of HTTPS on the Global Maven repository. My solution was to create a Maven settings.xml that forced it to use HTTP.

当使用IBM RSA 9.6.1构建一个全新的开发机器时,我遇到了这个问题。我的问题最终是由于在全局Maven存储库上的HTTPS。我的解决方案是创建Maven设置。迫使它使用HTTP的xml。

The key to me was that the central repository was empty when I exploded it under Maven Repositories -- > Global Repositories

我的关键是,当我在Maven存储库(>全局存储库)下爆炸时,*存储库是空的

Using the following settings file worked for me:

使用以下设置文件对我有用:

<settings>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>insecurecentral</activeProfile>
  </activeProfiles>
  <profiles>
    <profile>
      <id>insecurecentral</id>
      <!--Override the repository (and pluginRepository) "central" from the Maven Super POM -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://repo.maven.apache.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://repo.maven.apache.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</settings>

I got the idea from this * question.

我是从这个*的问题中得到这个想法的。

#1


7  

Have you tried to remove the proxy username and password? A similar poster encountered that issue:

您是否试图删除代理用户名和密码?类似的海报也遇到了这个问题:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved

无法计算构建计划:插件org.apache. mavenins:maven-jar-plugin:2.3.2或其中一个依赖项无法解决

Failing that I found the following worked:

如果没有,我发现以下方法是有效的:

  1. Delete project in Eclipse (but do not delete the contents on disk)
  2. 在Eclipse中删除项目(但不删除磁盘上的内容)
  3. Delete all files in your Maven repository
  4. 删除Maven存储库中的所有文件
  5. Re-download all Maven dependencies:
  6. 重新下载所有Maven的依赖关系:

mvn dependency:resolve

mvn依赖性:解决

  1. Start up Eclipse
  2. 启动Eclipse
  3. Ensure that Eclipse is configured to use your external Maven installation (Window->Preferences->Maven->Installations)
  4. 确保将Eclipse配置为使用外部Maven安装(窗口->首选项->Maven->安装)
  5. Re-import the existing project(s) into Eclipse
  6. 将现有项目重新导入Eclipse。
  7. Ensure that there are no Maven Eclipse plugin errors on the final screen of the project import
  8. 确保在项目导入的最终屏幕上没有Maven Eclipse插件错误。

#2


5  

You only need to delete one folder it is throwing error for. Just go to your M2 repo and org/apache/maven/plugins/maven-compiler-plugins and delete the folder 2.3.2

您只需要删除它正在抛出错误的一个文件夹。只需进入M2 repo和org/apache/maven/plugins/maven-compiler-plugins并删除2.3.2文件夹

#3


1  

The issue has been resolved while installation of the maven settings is provided as External in Eclipse. The navigation settings are Window --> Preferences --> Installations. Select the External as installation Type, provide the Installation home and name and click on Finish. Finally select this as default installations.

当maven设置的安装作为Eclipse中的外部设置提供时,这个问题已经解决。导航设置是窗口——>首选项——>安装。选择外部作为安装类型,提供安装home和名称,然后单击Finish。最后选择这个作为默认安装。

#4


0  

I was getting this problem when using IBM RSA 9.6.1 when building a brand new development machine. The problem for me ended up being because of HTTPS on the Global Maven repository. My solution was to create a Maven settings.xml that forced it to use HTTP.

当使用IBM RSA 9.6.1构建一个全新的开发机器时,我遇到了这个问题。我的问题最终是由于在全局Maven存储库上的HTTPS。我的解决方案是创建Maven设置。迫使它使用HTTP的xml。

The key to me was that the central repository was empty when I exploded it under Maven Repositories -- > Global Repositories

我的关键是,当我在Maven存储库(>全局存储库)下爆炸时,*存储库是空的

Using the following settings file worked for me:

使用以下设置文件对我有用:

<settings>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>insecurecentral</activeProfile>
  </activeProfiles>
  <profiles>
    <profile>
      <id>insecurecentral</id>
      <!--Override the repository (and pluginRepository) "central" from the Maven Super POM -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://repo.maven.apache.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://repo.maven.apache.org/maven2</url>
          <releases>
            <enabled>true</enabled>
          </releases>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</settings>

I got the idea from this * question.

我是从这个*的问题中得到这个想法的。