【发布时间】:2014-03-31 05:06:45
【问题描述】:
今天我访问了official Maven website,惊讶地发现那里列出了 3 个版本:3.0.5、3.1.1 和 3.2.1
我目前使用的是 3.0.5,想知道是否应该升级到更新的版本。
不幸的是,网站上没有一个关于版本之间有什么不同,是否建议升级,是否升级到什么版本的消息。
谁能指出相关资源?
【问题讨论】:
今天我访问了official Maven website,惊讶地发现那里列出了 3 个版本:3.0.5、3.1.1 和 3.2.1
我目前使用的是 3.0.5,想知道是否应该升级到更新的版本。
不幸的是,网站上没有一个关于版本之间有什么不同,是否建议升级,是否升级到什么版本的消息。
谁能指出相关资源?
【问题讨论】:
我建议你阅读release notes;例如,3.1.1 有 bug 修复
[MNG-5459] - failure to resolve pom artifact from snapshotVersion in maven-metadata.xml
[MNG-5495] - API incompatibility causes Swagger Maven Plugin (and others) to fail under Maven 3.1.0
[MNG-5499] - maven-aether-provider leaks Sisu Plexus and ObjectWeb classes onto the classpath when they are not required
[MNG-5500] - help for --legacy-local-repository option explains _maven.repositories instead of _remote.repositories
[MNG-5503] - Maven 3.1.0 fails to resolve artifacts produced by reactor build
[MNG-5509] - org.apache.maven.repository.legacy.DefaultWagonManager should set User-Agent
编辑:
如果你向下滚动,你可能会注意到
发行说明 - Maven - 版本 3.1.0(仅从 3.0.5 开始) 错误
[MNG-3131] - Error message is misleading if a missing plugin parameter is of a type like List
[MNG-5016] - A mirror's layout setting should default to 'default' since thats' the only layout supported lay in maven 3
[MNG-5206] - plexus container never disposed
[MNG-5208] - Parallel (-T option) multi module build fires wrong "project failed event"
[MNG-5209] - MavenProject.getTestClasspathElements can return null elements
[MNG-5212] - DefaultPluginDescriptorCache does not retain pluginDescriptor dependencies
[MNG-5214] - Dependency resolution substitutes g:a:v:jar for j:a:v:something-else when something-else isn't in the reactor
[MNG-5233] - ArtifactMetadataRetrievalException from org.apache.maven.artifact.metadata is not anymore binary compatible.
[MNG-5258] - localRepository in settings.xml does not handle ~ as home.dir
[MNG-5261] - upgrade wagon version to 2.3 to fix issues with redirect
[MNG-5270] - README.bootstrap.txt says "Ant 1.6.5 or later" BUT 1.8 or later is needed
[MNG-5280] - Inconsistent order of repositories and pluginRepositories from profiles in settings (regression Maven 3)
[MNG-5289] - -Dmaven.repo.local not honored
[MNG-5312] - MavenProject.getParent intolerably slow when import scope used heavily
[MNG-5313] - Unnecessary DefaultModelBuilder.build overload
[MNG-5314] - DefaultModelValidator misuses String.matches
[MNG-5336] - Descriptor Reference for settings.xml is incorrect
[MNG-5387] - Add ability to replace an artifact in mid-build
[MNG-5390] - mvn -rf (no argument) results in NPE
[MNG-5395] - logger name for plugins should not be DefaultMavenPluginManager
[MNG-5396] - logger name for execution events should not be MavenCli
[MNG-5398] - scriptSourceDirectory in superpom is not prefixed with /usr/home/cmsslave/slave15/maven-site-staging/build/trunk/
[MNG-5403] - tar.gz release artifacts have wrong permissions on directories
[MNG-5418] - Can't activate a profile by checking for the presence of a file in $myProperty
[MNG-5430] - use wagon 2.4
[MNG-5444] - ModelSource API is not sufficient to resolve project hierachies
[MNG-5445] - Missing PathTranslator @Requirement in org.apache.maven.project.interpolation.StringSearchModelInterpolator
[MNG-5456] - Maven skips modules and reports success if parallel build encounters java.lang.Error
[MNG-5477] - "malformed POM" warning issued when no version in reporting section
改进
[MNG-4505] - use slf4j to control various logging frameworks
[MNG-5181] - New resolution from local repository is very confusing
[MNG-5239] - Maven integration developers would like to be able to override the maven logging appender.
[MNG-5245] - upgrade default plugins versions
[MNG-5338] - Accept a directory with -f/--file
[MNG-5350] - improve @threadSafe error message: tell which goal
[MNG-5399] - Upgrade version of maven-release-plugin in superpom to 2.3.2
[MNG-5400] - Upgrade version of maven-dependency-plugin in superpom to 2.5
[MNG-5402] - Better build number for git
[MNG-5480] - document in POM descriptor reference how urls are interpolated from parent
[MNG-5482] - Catch NoClassDefFoundError org/sonatype/aether
新功能
[MNG-519] - Timestamps on messages
[MNG-5306] - for IDE embedding have ways of collecting model problems without failing the process
[MNG-5343] - Allow the use of JSR330 annotation in Maven extensions and plugins
[MNG-5344] - Allow the SLF4J loggers to be @Injected
[MNG-5354] - Integrate Eclipse Aether 0.9.0.M2
[MNG-5380] - Cannot preserve whitespace in Maven plugin configuration
[MNG-5381] - Restore MavenSession.getRepositoryCache()
[MNG-5382] - Add an IT for @Inject used in plugins
[MNG-5386] - Dispose of ClassRealms after invocation to prevent out of Permgen errors
[MNG-5388] - Restore embedded integration tests
[MNG-5391] - Update the default WAR plugin version to avoid version 2.3
[MNG-5393] - Look at Sonar's use of SLF4J and Logback
[MNG-5397] - Use SLF4J for logging
[MNG-5407] - Change MavenITmng1830ShowVersionTest to account for SHA1 as version
任务
[MNG-5279] - add CLI options to documentation
[MNG-5365] - Replace Aether's deprecated ConfigurationProperties with ConfigUtils
[MNG-5372] - remove classes that were added during Maven 3 alpha and beta but were deprecated before 3.0 final release
[MNG-5373] - Document the usage and benefits of JSR330
[MNG-5374] - Fix transfer listener after the JSR330 merge
[MNG-5375] - Document use of SLF4J
[MNG-5376] - Account for changes between the Apple and Oracle JDKs on OSX
[MNG-5453] - Update Maven 3 build to use Eclipse/Sisu
希望
[MNG-5370] - separate artifact-handlers configuration from plugin bindings to default lifecycle
[MNG-5461] - rename _maven.repositories tracking file to _remote.repositories
最后,3.2.1 记录在案here。
【讨论】:
对于使用 Maven 的软件开发人员来说,有两点需要了解:
在其他方面,3.1.x 和 3.2.x 只是 maven 的演变。 版本 3.1.x 和 3.2.x 对内部 maven 机制的更改比对用户体验的更改更多。他们现在在内部使用 SLF4J,更改了一些库实现,一些 CDI 机制...... 但是,也有一些用户友好的功能。像“版本范围”支持。
总而言之....我开始考虑 gradle :)
【讨论】:
自 Codehaus 于 2015 年 4 月关闭以来,历史版本说明(例如 3.2.1 中)中的一些链接已损坏。您可以在以下位置浏览它们:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12316922
需要考虑的重要一点:升级 Maven 将升级 默认 版本的核心插件。几乎所有关于 Maven 的有趣的事情都在插件中完成(因此你不会在 Maven 本身的发行说明中发现许多惊天动地的变化)。
如果您依赖默认插件版本,则需要查看插件发行说明以及 maven 版本。例如,3.2.1 的发行说明不包括 Wagon 2.6 附带的更改。
我建议不要依赖 maven 的插件版本默认值,因为同事使用稍微不同的 Maven 版本太容易导致由于插件差异而导致构建不一致。
如果您还没有这样做,我建议您在 pom; 中明确指定您的 maven 版本;例如:
<prerequisites>
<maven>3.0.5</maven>
</prerequisites>
然后添加对versions-maven-plugin的依赖并运行
mvn versions:display-plugin-updates.
这将为您提供适用于您的 maven 版本的插件可用的所有更新列表。谷歌看看是否有任何感兴趣的变化。当然你可以选择只升级一些插件,但不管你是否明确指定你所有的插件依赖。
【讨论】:
upgrading Maven will upgrade the default version of core plugins. 如果您错误地没有在项目中定义插件版本,这是正确的...