Maven 3 关于 build.plugins.plugin.version 的警告 [英] Maven 3 warnings about build.plugins.plugin.version

查看:99
本文介绍了Maven 3 关于 build.plugins.plugin.version 的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我更新到 Maven 3 后,我在每次构建时都会收到以下警告消息:

Since I updated to Maven 3 I get the following warning messages at each build :

我怎样才能摆脱这些警告?

How can I get rid of these warnings?

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for proj:id:jar:3.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 195, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 204, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 227, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 215, column 15
[WARNING] 'reporting.plugins.plugin.version' for org.codehaus.mojo:jdepend-maven-plugin is missing. @ line 271, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

推荐答案

后面添加一个 元素; 在您的 pom.xml 文件中.找到以下文本:

Add a <version> element after the <plugin> <artifactId> in your pom.xml file. Find the following text:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>

给它添加版本标签:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>2.3.2</version>

应该解决警告.

关于这个:

'build.plugins.plugin.version' 用于org.apache.maven.plugins:maven-compiler-plugin 丢失

'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing

很多人都提到了为什么会出现这个问题,但没有提出修复建议.我需要做的就是进入我的项目的 POM 文件,并添加 标记,如上所示.

Many people have mentioned why the issue is happening, but fail to suggest a fix. All I needed to do was to go into my POM file for my project, and add the <version> tag as shown above.

要发现版本号,一种方法是在 Maven 运行完成后查看其输出.如果缺少版本号,Maven 将显示其默认版本:

To discover the version number, one way is to look in Maven's output after it finishes running. Where you are missing version numbers, Maven will display its default version:

[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ entities ---

获取该版本号(如上面的 2.3.2 中所示)并将其添加到您的 POM 中,如图所示.

Take that version number (as in the 2.3.2 above) and add it to your POM, as shown.

这篇关于Maven 3 关于 build.plugins.plugin.version 的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆