eclipse MavenArchiver.getManifest() 中的 m2e 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37555557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:38:44  来源:igfitidea点击:

m2e error in MavenArchiver.getManifest()

eclipsemavenmaven-3m2emaven-jar-plugin

提问by scottmf

I am seeing an error in my STS and am not sure how to debug it. Searching around I only see vague references to the error and no solutions.

我在 STS 中看到错误,但不确定如何调试它。四处搜索,我只看到对错误的模糊引用,没有解决方案。

The error is:

错误是:

org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration)pom.xml/<maven projectName>line 1 Maven Configuration Problem

org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration)pom.xml/ <maven projectName>line 1 Maven 配置问题

Question: Can anyone give any suggestions on how to get more information on the issue in order to debug it further or any possible solutions?

问题:任何人都可以就如何获取有关该问题的更多信息以进一步调试或任何可能的解决方案提出任何建议吗?

Maybe some more context on what the functionality of method is. The javadoc associated with the MavenArchiver.getManifest()method is not very detailed and there is no stack trace that I see. I've tried several refreshes and updates of the project and associated projects including clearing my local m2 repo.

也许更多关于方法功能的上下文。与该MavenArchiver.getManifest()方法相关的 javadoc不是很详细,我也没有看到堆栈跟踪。我已经尝试了几次项目和相关项目的刷新和更新,包括清除我的本地 m2 存储库。

STS info:

STS信息

  • Version: 3.7.3.RELEASE
  • Build Id: 201602250940
  • Platform: Eclipse Mars.2 (4.5.2)
  • 版本:3.7.3.RELEASE
  • 内部版本号:201602250940
  • 平台:Eclipse Mars.2 (4.5.2)

m2e info:

m2e信息

  • Version: 1.6.2.20150902-0002
  • 版本:1.6.2.20150902-0002

回答by A_Di-Matteo

I encountered the same issue after updating the maven-jar-pluginto its latest version (at the time of writing), 3.0.2.
Eclipse 4.5.2started flagging the pom.xmlfile with the org.apache.maven.archiver.MavenArchiver.getManifesterror and a Maven> Update Project..would not fix it.

将 更新maven-jar-plugin到最新版本(撰写本文时)后,我遇到了同样的问题3.0.2
Eclipse4.5.2开始pom.xmlorg.apache.maven.archiver.MavenArchiver.getManifest错误标记文件,并且Maven> Update Project..不会修复它。

Easy solution: downgrade to 2.6 version
Indeed a possible solution is to get back to version 2.6, a further update of the project would then remove any error. However, that's notthe ideal scenario and a better solution is possible: update the m2eextensions (Eclipse Maven integration).

简单的解决方案:降级到 2.6 版本
事实上,一个可能的解决方案是回到 version 2.6,项目的进一步更新将消除任何错误。但是,这不是理想的情况,可能有更好的解决方案:更新m2e扩展(Eclipse Maven 集成)。

Better solution: update Eclipse m2e extensions
From Help> Install New Software.., add a new repository (via the Add..option), pointing to the following URL:

更好的解决方案:
Help> Install New Software..更新 Eclipse m2e 扩展,添加一个新的存储库(通过Add..选项),指向以下 URL:

  • https://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.17.2/N/LATEST/
  • https://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.17.2/N/LATEST/

Then follow the update wizard as usual. Eclipse would then require a restart. Afterwards, a further Update Project..on the concerned Maven project would remove any error and your Maven build could then enjoy the benefit of the latest maven-jar-pluginversion.

然后像往常一样按照更新向导进行操作。然后 Eclipse 将需要重新启动。之后,有关 Maven 项目的进一步更新项目..将删除任何错误,然后您的 Maven 构建可以享受最新maven-jar-plugin版本的好处。



Additonal notes
The reason for this issue is that from version 3.0.0on, the concerned component, the maven-archiverand the related plexus-archiverhas been upgraded to newer versions, breaking internal usages (via reflections) of the m2eintegration in Eclipse. The only solution is then to properly update Eclipse, as described above.
Also note: while Eclipse would initially report errors, the Maven build (e.g. from command line) would keep on working perfectly, this issue is only related to the Eclipse-Maven integration, that is, to the IDE.

附加说明
此问题的原因是,从版本3.0.0开始,相关组件maven-archiver和相关组件plexus-archiver已升级到较新版本,从而破坏m2e了 Eclipse 中集成的内部使用(通过反射)。唯一的解决方案是正确更新 Eclipse,如上所述。
另请注意:虽然 Eclipse 最初会报告错误,但 Maven 构建(例如,从命令行)将继续正常工作,此问题仅与 Eclipse-Maven 集成有关,即与 IDE 相关。

回答by scottmf

I found my answer! I looked into the pom for any plugins that have a dependency on the maven-archiver and found the maven-jar-plugin does. It was using the latest 3.0.0 version. When I downgraded to 2.6 it seems to fix the issue :-)

我找到了我的答案!我查看了 pom 中是否有任何依赖于 maven-archiver 的插件,并发现 maven-jar-plugin 确实如此。它使用的是最新的 3.0.0 版本。当我降级到 2.6 时,它似乎解决了这个问题:-)

回答by Ala Messaoudi

I had the same problem with a spring boot project. the solution was to downgrade the jar maven-jar-plugin from 3.2 to 2.6 . i had just to add this to the project pom:

我在 Spring Boot 项目中遇到了同样的问题。解决方案是将 jar maven-jar-plugin 从 3.2 降级到 2.6 。我只需将它添加到项目 pom 中:

<properties>        
    <maven-jar-plugin.version>2.6</maven-jar-plugin.version>
</properties>

回答by Ravi Rajamiyer

I had exactly the same problem. My environmentwas:

我遇到了完全相同的问题。我的环境是:

  • Spring STS 3.7.3.RELEASE
  • Build Id: 201602250940
  • Platform: Eclipse Mars.2 (4.5.2)
  • 春季 STS 3.7.3.RELEASE
  • 内部版本号:201602250940
  • 平台:Eclipse Mars.2 (4.5.2)

The symptomsof the problems were:

问题的症状是:

  1. There was a red error flag on my PM file. and the description of the error was as described in the original question asked here.
  2. There were known compilation problems in the several Java files in the project, but eclipse still was not showing them flagged as error in the editor pane as well as the project explorer tree on the left side.
  1. 我的 PM 文件上有一个红色错误标志。并且错误的描述如此处提出的原始问题中所述。
  2. 项目中的几个 Java 文件存在已知的编译问题,但 Eclipse 仍然没有在编辑器窗格和左侧的项目资源管理器树中显示它们标记为错误。

The solution (described above) about updating the m2e extensions worked for me.

关于更新 m2e 扩展的解决方案(如上所述)对我有用。

Better solution(my recommondation):

更好的解决方案(我的建议):

回答by Saurav

I had the same problem with a spring boot project. The solution was to downgrade the spring-boot-starter-parent dependency version from 2.0.0.RELEASE to 1.5.10.RELEASE(you can move to any stable version)

我在 Spring Boot 项目中遇到了同样的问题。解决方案是将 spring-boot-starter-parent 依赖版本从 2.0.0.RELEASE 降级到 1.5.10.RELEASE(您可以移动到任何稳定版本)

from:

从:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

to

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.10.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

回答by Vaibhav Sharma

I had also faced the same issue and it got resolved by changing the versionfrom 3.2.0to 2.6as shown in below pom.xml snippet

我也遇到了同样的问题,它通过将版本3.2.0更改为2.6 来解决,如下面的 pom.xml 片段所示

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <warSourceDirectory>src/main/webapp</warSourceDirectory>
        <warName>Spring4MVC</warName>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
</plugin>

回答by VENKAT S

Upgrade your m2e extensions instead downgrade.

升级您的 m2e 扩展而不是降级。

From Help > Install New Software.., add a new repository (via the Add.. option)

从 Help > Install New Software..,添加一个新的存储库(通过 Add.. 选项)

Specify name for your plugin and add path http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.17.2/N/LATEST/

为您的插件指定名称并添加路径http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.17.2/N/LATEST/

once you are done with installation, please restart eclipse and update your project.

安装完成后,请重新启动 eclipse 并更新您的项目。

回答by Ravindra Dandothya

I also faced the similar issues, changing the version from 2.0.0.RELEASEto 1.5.10.RELEASEworked for me, please try it before downgrading the maven version

我也遇到了类似的问题,将版本从2.0.0.RELEASE 更改1.5.10.RELEASE对我有用,请在降级 maven 版本之前尝试

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
<dependencies>
 <dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-web</artifactId>
 </dependency>  
</dependencies>

回答by Mants

Use the steps given in this link. It worked for me.

使用此链接中给出的步骤。它对我有用。

Step - 1 Right click on your project in Eclipse

步骤 - 1 在 Eclipse 中右键单击您的项目

Step - 2 Click Properties

步骤 - 2 单击属性

Step - 3 Select Maven in the left hand side list.

步骤 - 3 在左侧列表中选择 Maven。

Step - 4 You will notice "pom.xml" in the Active Maven Profiles text box on the right hand side. Clear it and click Apply.

步骤 - 4 您会在右侧的 Active Maven Profiles 文本框中注意到“pom.xml”。清除它并单击应用。

Step - 5 Run As -> Maven clean -> Maven Install

步骤 - 5 运行方式 -> Maven clean -> Maven Install

Hope it helps!

希望能帮助到你!