IBM / cics-bundle-maven

The plugin to build and deploy CICS bundles in a Maven build.
https://ibm.github.io/cics-bundle-maven/plugin-info.html
Eclipse Public License 2.0
18 stars 25 forks source link

Updates plugins and dependencies to latest #181

Closed ledina closed 2 years ago

ledina commented 2 years ago

And fix Maven version to 5.4

stewartfrancis commented 2 years ago

Your branch fails to build for me with Maven 3.8.4 and Open JDK 11. I get errors in the osgi bundle it builds where it can't find a target platform description for Java 17, which probably means there's something to fix there to do with an updated plugin defaulting to a newer Java execution environment than my runtime knows about.

Also I still have reservations about bumping maven-core version beyond 3.5. I don't think we've done a particularly good job of specifying what our minimum required version of Maven is, or enforcing that, but I think your changes to some of the dependencies may potentially lead us to break that compatibility in the future. For example, in the build log when building your branch (Maven 3.5.0, JDK 11)

Some dependencies of Maven Plugins are expected to be in provided scope.
Please make sure that dependencies listed below declared in POM
have set '<scope>provided</scope>' as well.

The following dependencies are in wrong scope:
 * org.apache.maven:maven-core:jar:3.8.4:compile
 * org.apache.maven:maven-model:jar:3.8.4:compile
 * org.apache.maven:maven-settings:jar:3.8.4:compile
 * org.apache.maven:maven-settings-builder:jar:3.8.4:compile
 * org.apache.maven:maven-builder-support:jar:3.8.4:compile
 * org.apache.maven:maven-repository-metadata:jar:3.8.4:compile
 * org.apache.maven:maven-artifact:jar:3.8.4:compile
 * org.apache.maven:maven-plugin-api:jar:3.8.4:compile
 * org.apache.maven:maven-model-builder:jar:3.8.4:compile
 * org.apache.maven:maven-resolver-provider:jar:3.8.4:compile
 * org.apache.maven:maven-compat:jar:3.0:compile

This is saying that the scope of these dependencies should be set to provided, meaning that the Maven runtime will be supplying those at runtime. The Maven runtime will only be able to supply versions of those dependencies that it has bundled within it. For instance from Maven 3.5.0's lib folder:

-rw-r--r--  1 stewf  staff   55003  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-artifact-3.5.0.jar
-rw-r--r--  1 stewf  staff   14886  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-builder-support-3.5.0.jar
-rw-r--r--  1 stewf  staff  290886  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-compat-3.5.0.jar
-rw-r--r--  1 stewf  staff  624638  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-core-3.5.0.jar
-rw-r--r--  1 stewf  staff   97453  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-embedder-3.5.0.jar
-rw-r--r--  1 stewf  staff  165015  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-model-3.5.0.jar
-rw-r--r--  1 stewf  staff  179298  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-model-builder-3.5.0.jar
-rw-r--r--  1 stewf  staff   47771  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-plugin-api-3.5.0.jar
-rw-r--r--  1 stewf  staff   27482  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-repository-metadata-3.5.0.jar
-rw-r--r--  1 stewf  staff  146422 20 Feb  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-resolver-api-1.0.3.jar
-rw-r--r--  1 stewf  staff   42200 20 Feb  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-resolver-connector-basic-1.0.3.jar
-rw-r--r--  1 stewf  staff  184324 20 Feb  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-resolver-impl-1.0.3.jar
-rw-r--r--  1 stewf  staff   68326  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-resolver-provider-3.5.0.jar
-rw-r--r--  1 stewf  staff   35583 20 Feb  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-resolver-spi-1.0.3.jar
-rw-r--r--  1 stewf  staff   30284 20 Feb  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-resolver-transport-wagon-1.0.3.jar
-rw-r--r--  1 stewf  staff  158956 20 Feb  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-resolver-util-1.0.3.jar
-rw-r--r--  1 stewf  staff   44581  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-settings-3.5.0.jar
-rw-r--r--  1 stewf  staff   43247  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-settings-builder-3.5.0.jar
-rw-r--r--  1 stewf  staff  163692 10 Jan  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-shared-utils-3.1.0.jar
-rw-r--r--  1 stewf  staff   19807  3 Apr  2017 /Users/stewf/.sdkman/candidates/maven/3.5.0/lib/maven-slf4j-provider-3.5.0.jar

My guess is that everything in Maven's lib directory is natively available to your plugin when executing, so depending on higher versions of those libs means we may end up using API that's not available in earlier versions of Maven that we intend to support. In general it'll be easier for customers if we can support as flexible a version of Maven as possible. I don't think we've done an amazing job of deciding that, or enforcing it, but I'm reading between the lines that our choice (probably mine) of maven-core 3.5.0 means that we're at least compatible with Maven 3.5.0. We ought to use the maven-provided plugin versions from that version of Maven in our dependency graph, to ensure we're compatible. I don't know if there's a good way to do that - I'd hope there's a BOM we could import the appropriate versions from.

Also worries me a bit that we have incomplete testing in that we're not running our tests against the correct combinations of the Maven runtime and the JDK. I'd suggest we want to test at a minimum against JDK 8 and 11, and Maven 3.5.0 and Maven 3.8(+?).

stewartfrancis commented 2 years ago

If we're going to pre-req Maven 3.5.4 (that'll be different to what I think we currently pre-req, but is unlikely to be a problem), you should set the scopes of those plugins that are provided by the Maven runtime to provided and ensure the versions match the versions that are shipped with Maven 3.5.4.

I did try running the latest version of your branch with Maven 3.5.4 and Java 8 and Java 11, both of which passed, which is great.

ledina commented 2 years ago

We are using the maven-enforcer-plugin to set requiredMavenVersion to 3.5.4. I have changed mave-core to also be 3.5.4. Fixed the scope issues by changing maven-core to be provided scope, and specified the remaining ones in the dependencyManagement section. Ready for a re-review @stewartfrancis