mojohaus / versions

Versions Maven Plugin
https://www.mojohaus.org/versions/versions-maven-plugin/
Apache License 2.0
337 stars 267 forks source link

add an option to exclude parent from properties updates #793

Closed jonathanlermitage closed 2 years ago

jonathanlermitage commented 2 years ago

Since version 2.13.0, the display-property-updates goal shows many properties updates for Spring Boot based projects.
Spring Boot projects use a Spring Boot parent pom which declares a BOM with many dependencies and their corresponding version properties.
Even if we don't actually use these dependencies (they are declared in a dependencyManagement block), the display-property-updates goals now shows updates for all of these properties.
I think it would be useful to provide a parameter that allows us to ignore version properties updates from parent's pom. If this parameter already exists, could you please update the documentation https://www.mojohaus.org/versions-maven-plugin/display-property-updates-mojo.html?
Thanks!

How to reproduce: create a sample Maven project with https://start.spring.io/. You can also test this project https://github.com/jonathanlermitage/spring-mvc-tiny-sample. Then, invoke display-property-updates and see the proposed properties updates.
With plugin 2.12.0 I get:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< coin.coin:spring-mvc-tiny-sample >------------------
[INFO] Building spring-mvc-tiny-sample 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:2.12.0:display-property-updates (default-cli) @ spring-mvc-tiny-sample ---
[INFO] Major version changes allowed
[INFO] Major version changes allowed
[INFO] Major version changes allowed
[INFO] 
[INFO] The following version property updates are available:
[INFO]   ${guava.version} ............................... 28.1-jre -> 31.1-jre
[INFO]   ${rest-assured.version} .............................. 4.1.1 -> 5.2.0
[INFO]   ${versions-maven-plugin.version} ................... 2.12.0 -> 2.13.0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.963 s
[INFO] Finished at: 2022-10-24T11:08:17-04:00
[INFO] ------------------------------------------------------------------------

With plugin 2.13.0 I get:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< coin.coin:spring-mvc-tiny-sample >------------------
[INFO] Building spring-mvc-tiny-sample 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:2.13.0:display-property-updates (default-cli) @ spring-mvc-tiny-sample ---
[INFO] 
[INFO] The following version properties are referencing the newest available version:
[INFO]   ${bitronix.version} ........................................... 2.1.4
[INFO]   ${classmate.version} .......................................... 1.5.1
[INFO]   ${commons-pool.version} ......................................... 1.6
[INFO]   ${couchbase-cache-client.version} ............................. 2.1.0
[INFO]   ${javax-activation.version} ................................... 1.2.0
[INFO]   ${javax-annotation.version} ................................... 1.3.2
[INFO]   ${javax-cache.version} ........................................ 1.1.1
[INFO]   ${javax-jaxws.version} ........................................ 2.3.1
[INFO]   ${javax-jms.version} .......................................... 2.0.1
[INFO]   ${javax-json.version} ......................................... 1.1.4
[INFO]   ${javax-jsonb.version} .......................................... 1.0
[INFO]   ${javax-mail.version} ......................................... 1.6.2
[INFO]   ${javax-persistence.version} .................................... 2.2
[INFO]   ${javax-transaction.version} .................................... 1.3
[INFO]   ${javax-validation.version} ............................. 2.0.1.Final
[INFO]   ${javax-websocket.version} ...................................... 1.1
[INFO]   ${jaxen.version} .............................................. 1.2.0
[INFO]   ${jest.version} ............................................... 6.3.1
[INFO]   ${jetty-jsp.version} ............................ 2.2.0.v201112011158
[INFO]   ${jmustache.version} ........................................... 1.15
[INFO]   ${jstl.version} ................................................. 1.2
[INFO]   ${jtds.version} ............................................... 1.3.1
[INFO]   ${nekohtml.version} .......................................... 1.9.22
[INFO]   ${nio-multipart-parser.version} ............................... 1.1.0
[INFO]   ${ojdbc.version} ........................................... 19.3.0.0
[INFO]   ${quartz.version} ............................................. 2.3.2
[INFO]   ${rxjava-adapter.version} ..................................... 1.2.1
[INFO]   ${rxjava.version} ............................................. 1.3.8
[INFO]   ${servlet-api.version} ........................................ 4.0.1
[INFO]   ${thymeleaf-extras-data-attribute.version} .................... 2.0.1
[INFO]   ${thymeleaf-extras-java8time.version} ................. 3.0.4.RELEASE
[INFO]   ${versions-maven-plugin.version} ............................. 2.13.0
[INFO]   ${webjars-hal-browser.version} .............................. 3325375
[INFO]   ${wsdl4j.version} ............................................. 1.6.3
[INFO]   ${xml-maven-plugin.version} ................................... 1.0.2
[INFO] The following version property updates are available:
[INFO]   ${activemq.version} ............................... 5.15.11 -> 5.16.5
[INFO]   ${antlr2.version} ................................. 2.7.7 -> 20030911
[INFO]   ${appengine-sdk.version} ............................ 1.9.77 -> 2.0.9
[INFO]   ${artemis.version} ................................. 2.10.1 -> 2.26.0
[INFO]   ${aspectj.version} ................................. 1.9.5 -> 1.9.9.1
[INFO]   ${assertj.version} ................................. 3.13.2 -> 3.23.1
[INFO]   ${atomikos.version} .................................. 4.0.6 -> 5.0.9
[INFO]   ${awaitility.version} ................................ 4.0.2 -> 4.2.0
[INFO]   ${build-helper-maven-plugin.version} ................. 3.0.0 -> 3.3.0
[INFO]   ${byte-buddy.version} ............................. 1.10.6 -> 1.12.18
[INFO]   ${caffeine.version} .................................. 2.8.0 -> 3.1.1
[INFO]   ${cassandra-driver.version} ......................... 3.7.2 -> 3.11.3
[INFO]   ${commons-codec.version} ............................... 1.13 -> 1.15
[INFO]   ${commons-dbcp2.version} ............................. 2.7.0 -> 2.9.0
[INFO]   ${commons-lang3.version} .............................. 3.9 -> 3.12.0
[INFO]   ${commons-pool2.version} ............................ 2.7.0 -> 2.11.1
[INFO]   ${couchbase-client.version} ......................... 2.7.11 -> 3.4.0
[INFO]   ${db2-jdbc.version} ............................ 11.5.0.0 -> 11.5.7.0
[INFO]   ${dependency-management-plugin.version} ...... 1.0.9.RELEASE -> 1.1.0
[INFO]   ${derby.version} ............................. 10.14.2.0 -> 10.16.1.1
[INFO]   ${dropwizard-metrics.version} ....................... 4.1.2 -> 4.2.12
[INFO]   ${ehcache.version} ............................... 2.10.6 -> 2.10.9.2
[INFO]   ${ehcache3.version} ................................. 3.8.1 -> 3.10.2
[INFO]   ${elasticsearch.version} ............................ 6.8.6 -> 7.17.6
[INFO]   ${embedded-mongo.version} ....................... 2.2.0 -> 4.0.6-beta
[INFO]   ${exec-maven-plugin.version} ......................... 1.6.0 -> 3.1.0
[INFO]   ${flatten-maven-plugin.version} ...................... 1.1.0 -> 1.3.0
[INFO]   ${flyway.version} .................................... 6.0.8 -> 9.5.1
[INFO]   ${freemarker.version} .............................. 2.3.29 -> 2.3.31
[INFO]   ${git-commit-id-plugin.version} ..................... 3.0.1 -> 4.9.10
[INFO]   ${glassfish-el.version} ........................... 3.0.3 -> 5.0.0-M1
[INFO]   ${glassfish-jaxb.version} ............................ 2.3.2 -> 4.0.1
[INFO]   ${groovy.version} ................................... 2.5.9 -> 2.5.14
[INFO]   ${gson.version} ...................................... 2.8.6 -> 2.9.1
[INFO]   ${guava.version} ............................... 28.1-jre -> 31.1-jre
[INFO]   ${h2.version} .................................... 1.4.200 -> 2.1.214
[INFO]   ${hamcrest.version} ...................................... 2.1 -> 2.2
[INFO]   ${hazelcast-hibernate5.version} ...................... 1.3.2 -> 2.2.1
[INFO]   ${hazelcast.version} .............................. 3.12.5 -> 3.12.13
[INFO]   ${hibernate-validator.version} .......... 6.0.18.Final -> 8.0.0.Final
[INFO]   ${hibernate.version} ................... 5.4.10.Final -> 5.6.12.Final
[INFO]   ${hikaricp.version} .................................. 3.4.2 -> 5.0.1
[INFO]   ${hsqldb.version} .................................... 2.5.0 -> 2.7.1
[INFO]   ${htmlunit.version} ................................ 2.36.0 -> 2.66.0
[INFO]   ${httpasyncclient.version} ........................... 4.1.4 -> 4.1.5
[INFO]   ${httpclient.version} .............................. 4.5.10 -> 4.5.13
[INFO]   ${httpcore.version} ................................ 4.4.13 -> 4.4.15
[INFO]   ${infinispan.version} .................. 9.4.17.Final -> 9.4.24.Final
[INFO]   ${influxdb-java.version} ............................... 2.15 -> 2.23
[INFO]   ${jackson-bom.version} ......................... 2.10.2 -> 2.14.0-rc2
[INFO]   ${jakarta-activation.version} ........................ 1.2.1 -> 2.0.1
[INFO]   ${jakarta-annotation.version} ........................ 1.3.5 -> 2.1.1
[INFO]   ${jakarta-jms.version} ............................... 2.0.3 -> 3.1.0
[INFO]   ${jakarta-json-bind.version} ......................... 1.0.2 -> 3.0.0
[INFO]   ${jakarta-json.version} .............................. 1.1.6 -> 2.1.1
[INFO]   ${jakarta-mail.version} .............................. 1.6.4 -> 2.1.0
[INFO]   ${jakarta-persistence.version} ....................... 2.2.3 -> 3.1.0
[INFO]   ${jakarta-servlet-jsp-jstl.version} .................. 1.2.7 -> 3.0.0
[INFO]   ${jakarta-servlet.version} ........................... 4.0.3 -> 6.0.0
[INFO]   ${jakarta-transaction.version} ....................... 1.3.3 -> 2.0.1
[INFO]   ${jakarta-validation.version} ........................ 2.0.2 -> 3.0.2
[INFO]   ${jakarta-websocket.version} ......................... 1.1.2 -> 2.1.0
[INFO]   ${jakarta-ws-rs.version} ............................. 2.1.6 -> 3.1.0
[INFO]   ${jakarta-xml-bind.version} .......................... 2.3.2 -> 4.0.0
[INFO]   ${jakarta-xml-ws.version} ............................ 2.3.2 -> 4.0.0
[INFO]   ${janino.version} .................................... 3.1.0 -> 3.1.8
[INFO]   ${javax-jaxb.version} ................... 2.3.1 -> 2.4.0-b180830.0359
[INFO]   ${javax-money.version} ................................. 1.0.3 -> 1.1
[INFO]   ${jaybird.version} ............................ 3.0.8 -> 4.0.0-beta-1
[INFO]   ${jboss-logging.version} ................. 3.4.1.Final -> 3.5.0.Final
[INFO]   ${jboss-transaction-spi.version} ......... 7.6.0.Final -> 7.6.1.Final
[INFO]   ${jdom2.version} ................................... 2.0.6 -> 2.0.6.1
[INFO]   ${jedis.version} ..................................... 3.1.0 -> 4.3.1
[INFO]   ${jersey.version} ................................ 2.29.1 -> 3.1.0-M8
[INFO]   ${jetty-el.version} ................................ 8.5.49 -> 10.1.1
[INFO]   ${jetty-reactive-httpclient.version} ................. 1.0.3 -> 3.0.7
[INFO]   ${jetty.version} .................. 9.4.25.v20191220 -> 12.0.0.alpha2
[INFO]   ${jna.version} ...................................... 4.5.2 -> 5.12.1
[INFO]   ${joda-time.version} ............................... 2.10.5 -> 2.12.0
[INFO]   ${johnzon.version} .................................. 1.2.2 -> 1.2.19
[INFO]   ${jolokia.version} ................................... 1.6.2 -> 1.7.1
[INFO]   ${jooq.version} .................................... 3.12.3 -> 3.17.4
[INFO]   ${json-path.version} ................................. 2.4.0 -> 2.7.0
[INFO]   ${jsonassert.version} ................................ 1.5.0 -> 1.5.1
[INFO]   ${junit-jupiter.version} ............................. 5.5.2 -> 5.9.1
[INFO]   ${junit.version} ..................................... 4.12 -> 4.13.2
[INFO]   ${kafka.version} ..................................... 2.3.1 -> 2.4.1
[INFO]   ${kotlin-coroutines.version} ......................... 1.3.3 -> 1.6.4
[INFO]   ${kotlin.version} .................................. 1.3.61 -> 1.7.20
[INFO]   ${lettuce.version} ................... 5.2.1.RELEASE -> 6.2.1.RELEASE
[INFO]   ${liquibase.version} ................................ 3.8.5 -> 4.17.0
[INFO]   ${log4j2.version} .................................. 2.12.1 -> 2.19.0
[INFO]   ${logback.version} ................................... 1.2.3 -> 1.4.4
[INFO]   ${lombok.version} ................................ 1.18.10 -> 1.18.24
[INFO]   ${mariadb.version} ................................... 2.4.4 -> 3.0.8
[INFO]   ${maven-antrun-plugin.version} ......................... 1.8 -> 3.1.0
[INFO]   ${maven-assembly-plugin.version} ..................... 3.1.1 -> 3.4.2
[INFO]   ${maven-clean-plugin.version} ........................ 3.1.0 -> 3.2.0
[INFO]   ${maven-compiler-plugin.version} .................... 3.8.1 -> 3.10.1
[INFO]   ${maven-dependency-plugin.version} ................... 3.1.1 -> 3.3.0
[INFO]   ${maven-deploy-plugin.version} ....................... 2.8.2 -> 3.0.0
[INFO]   ${maven-enforcer-plugin.version} .................. 3.0.0-M3 -> 3.1.0
[INFO]   ${maven-failsafe-plugin.version} ................. 2.22.2 -> 3.0.0-M7
[INFO]   ${maven-help-plugin.version} ......................... 3.2.0 -> 3.3.0
[INFO]   ${maven-install-plugin.version} ...................... 2.5.2 -> 3.0.1
[INFO]   ${maven-invoker-plugin.version} ...................... 3.2.1 -> 3.3.0
[INFO]   ${maven-jar-plugin.version} .......................... 3.1.2 -> 3.3.0
[INFO]   ${maven-javadoc-plugin.version} ...................... 3.1.1 -> 3.4.1
[INFO]   ${maven-resources-plugin.version} .................... 3.1.0 -> 3.3.0
[INFO]   ${maven-shade-plugin.version} ........................ 3.2.1 -> 3.4.0
[INFO]   ${maven-site-plugin.version} ...................... 3.8.2 -> 4.0.0-M3
[INFO]   ${maven-source-plugin.version} ....................... 3.1.0 -> 3.2.1
[INFO]   ${maven-surefire-plugin.version} ................. 2.22.2 -> 3.0.0-M7
[INFO]   ${maven-war-plugin.version} .......................... 3.2.3 -> 3.3.2
[INFO]   ${micrometer.version} ................................ 1.3.2 -> 1.9.5
[INFO]   ${mimepull.version} ................................ 1.9.12 -> 1.10.0
[INFO]   ${mockito.version} ................................... 3.1.0 -> 4.8.1
[INFO]   ${mongo-driver-reactivestreams.version} ....... 1.12.0 -> 4.8.0-beta0
[INFO]   ${mongodb.version} ................................ 3.11.2 -> 3.12.11
[INFO]   ${mssql-jdbc.version} .................... 7.4.1.jre8 -> 11.2.1.jre18
[INFO]   ${mysql.version} ................................... 8.0.19 -> 8.0.31
[INFO]   ${neo4j-ogm.version} ................................ 3.2.6 -> 3.2.37
[INFO]   ${netty-tcnative.version} .............. 2.0.28.Final -> 2.0.54.Final
[INFO]   ${netty.version} ....................... 4.1.45.Final -> 4.1.84.Final
[INFO]   ${okhttp3.version} ................................. 3.14.6 -> 3.14.9
[INFO]   ${pooled-jms.version} ................................ 1.0.6 -> 3.0.0
[INFO]   ${postgresql.version} .............................. 42.2.9 -> 42.5.0
[INFO]   ${prometheus-pushgateway.version} ................... 0.7.0 -> 0.16.0
[INFO]   ${querydsl.version} .................................. 4.2.2 -> 5.0.0
[INFO]   ${rabbit-amqp-client.version} ....................... 5.7.3 -> 5.16.0
[INFO]   ${reactive-streams.version} .......................... 1.0.3 -> 1.0.4
[INFO]   ${reactor-bom.version} .................. Dysprosium-SR4 -> 2020.0.24
[INFO]   ${rest-assured.version} .............................. 4.1.1 -> 5.2.0
[INFO]   ${rsocket.version} ............................... 1.0.0-RC5 -> 1.1.3
[INFO]   ${rxjava2.version} ................................. 2.2.17 -> 2.2.21
[INFO]   ${saaj-impl.version} ................................. 1.5.1 -> 3.0.0
[INFO]   ${selenium-htmlunit.version} ........................ 2.36.0 -> 4.5.2
[INFO]   ${selenium.version} ............................... 3.141.59 -> 4.4.0
[INFO]   ${sendgrid.version} .................................. 4.4.1 -> 4.9.3
[INFO]   ${slf4j.version} ................................... 1.7.30 -> 1.7.36
[INFO]   ${snakeyaml.version} ................................... 1.25 -> 1.33
[INFO]   ${solr.version} ...................................... 8.2.0 -> 8.7.0
[INFO]   ${spring-amqp.version} ....................... 2.2.3.RELEASE -> 2.4.7
[INFO]   ${spring-batch.version} ...................... 4.2.1.RELEASE -> 4.3.7
[INFO]   ${spring-cloud-connectors.version} ... 2.0.7.RELEASE -> 2.0.9.RELEASE
[INFO]   ${spring-data-releasetrain.version} ...... Moore-SR4 -> 1.4.6.RELEASE
[INFO]   ${spring-framework.version} ................. 5.2.3.RELEASE -> 5.3.23
[INFO]   ${spring-hateoas.version} .................... 1.0.3.RELEASE -> 1.5.2
[INFO]   ${spring-integration.version} ............... 5.2.3.RELEASE -> 5.5.15
[INFO]   ${spring-kafka.version} ...................... 2.3.5.RELEASE -> 2.9.2
[INFO]   ${spring-ldap.version} ............... 2.3.2.RELEASE -> 2.3.8.RELEASE
[INFO]   ${spring-restdocs.version} ........... 2.0.4.RELEASE -> 2.0.6.RELEASE
[INFO]   ${spring-retry.version} ...................... 1.2.5.RELEASE -> 1.3.4
[INFO]   ${spring-security.version} ................... 5.2.1.RELEASE -> 5.7.4
[INFO]   ${spring-session-bom.version} .............. Corn-RELEASE -> 2021.2.0
[INFO]   ${spring-ws.version} ......................... 3.0.8.RELEASE -> 3.1.3
[INFO]   ${sqlite-jdbc.version} ........................... 3.28.0 -> 3.39.3.0
[INFO]   ${sun-mail.version} .................................. 1.6.4 -> 2.0.1
[INFO]   ${thymeleaf-extras-springsecurity.version}  3.0.4.RELEASE -> 3.1.0.RC1
[INFO]   ${thymeleaf-layout-dialect.version} .................. 2.4.1 -> 3.1.0
[INFO]   ${thymeleaf.version} .................... 3.0.11.RELEASE -> 3.1.0.RC1
[INFO]   ${tomcat.version} .................................. 9.0.30 -> 10.1.1
[INFO]   ${unboundid-ldapsdk.version} ........................ 4.0.14 -> 6.0.6
[INFO]   ${undertow.version} ..................... 2.0.29.Final -> 2.3.0.Final
[INFO]   ${webjars-locator-core.version} ........................ 0.41 -> 0.52
[INFO]   ${xmlunit2.version} .................................. 2.6.3 -> 2.9.0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.470 s
[INFO] Finished at: 2022-10-24T11:08:02-04:00
[INFO] ------------------------------------------------------------------------
andrzejj0 commented 2 years ago

This is a result of fixing #367.

Indeed, very valid request. I'll definitely consider it.

andrzejj0 commented 2 years ago

New option: includeParent, default true.

Adding the same option to property-updates-report.

edwinvanderham commented 1 year ago

Should this includeParent property not also be added to update-properties?

Since upgrading from 2.12.0 to 2.13.0, the update-properties for a reactor project takes much much longer and is way more verbose than before. In every reactor module, I get the same message about properties being unchanged, whereas before I would only see this in the root module.

andrzejj0 commented 1 year ago

I agree that it's more chatty than before. It's a side effect of #367. I think it doesn't really add any value there. While it will discover property updates from parent POMs, it won't be able to modify them anyway. So it's a genuine bug, which needs to be addressed, not just a question of providing the property there.

What's worse, versions-changes.xml will record a change that did not occur.

andrzejj0 commented 1 year ago

@edwinvanderham could you please create a new issue? Thanks Created #837

andrzejj0 commented 1 year ago

Edit -- it does matter after all if the child POM redefines a property defined and used in the parent. - #582

So, I'll add includeParent, equal to true.

edwinvanderham commented 1 year ago

@ajarmoniuk thank you for the quick response