Maven 3はプラグインのバージョンを知る必要があります
Maven 2では、 `pom.xml`で使われた各プラグインのバージョンを指定しなかった場合、最新のプラグインバージョンが自動的に選択されます。これはとても便利です。しかし、Maven 3では、プラグインのバージョンを明示的に指定しなかった場合、警告メッセージが表示されます。詳細については、この「https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-AutomaticPluginVersionResolution[Maven 3互換性」をお読みください。
たとえば、Maven 2では、通常、バージョンを指定せずに “maven-compiler-plugin`”プラグインを使用し、100%有効です。
//...pom.xml in Maven 2 <build> <finalName>SpringMVC</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>//...
しかし、Maven 3では、上記の宣言は ”
WARNING
“メッセージに続いてあなたを促します:
….[INFO]Scanning for projects…[WARNING]Some problems were encountered while building the effective model
for com.mkyong.common:SpringMVC:war:1.0-SNAPSHOT[WARNING]’build.plugins.plugin.version’ for org.apache.maven.plugins:maven-compiler-plugin
is missing. @ line 55, column 12[WARNING]It is highly recommended to fix these problems because they threaten
the stability of your build.[WARNING]For this reason, future Maven versions might no longer support
building such malformed projects.
これを修正するには、プラグインのバージョンを次のように指定します:
//...pom.xml in Maven 3 <build> <finalName>SpringMVC</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>
** Mavenのプラグインのバージョンを知るには?** + http://search.maven.org/でプラグインを検索するか、プラグインのWebサイト(http://maven.apache.org/plugins)を参照してください。/maven-compiler-plugin/index.html[Mavenコンパイラプラグイン公式サイト]。 === 参考文献 . https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html[Maven 3互換性]。 http://maven.apache.org/plugins/maven-compiler-plugin/index.html[Maven コンパイラプラグイン] link://tag/maven/[maven]link://tag/maven3/[maven3]