Skip to content

[fix] Decouple samples from the parent pom #1240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 27, 2023
Merged

Conversation

scottgerring
Copy link
Contributor

@scottgerring scottgerring commented Jun 25, 2023

Issue #, if available:
#1224

Description of changes:

The examples are two layers of maven module beneath the parent pom parent --> examples --> [parameters / core / sqs / etc example projects]. At each layer a dependency upwards on the immediate parent pom is included - the example projects themselves have dependencies on the examples common parent, and the examples common parent has a dependency on the overall parent.
This change keeps the module composition, but removes the parents. This means that all the dependencies have to be specified in each example project, but the advantage is that the example projects can be taken and used as-is - they are completely self contained.

By keeping the module composition going down, we also ensure that the build continues to work as you would expect - changing the interface of the parameters project for instance will break the parameters example and the build, giving the developer immediate feedback.

Checklist

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jun 25, 2023
@scottgerring
Copy link
Contributor Author

@jeromevdl is it obvious to you why this build is failing off the top of your head? If not I will dive deep.

Parameters example fails with:

Error:  Failed to execute goal dev.aspectj:aspectj-maven-plugin:1.13.1:compile (default) on project powertools-examples-core: Execution default of goal dev.aspectj:aspectj-maven-plugin:1.13.1:compile failed: An API incompatibility was encountered while executing dev.aspectj:aspectj-maven-plugin:1.13.1:compile: java.lang.UnsupportedClassVersionError: org/eclipse/core/runtime/OperationCanceledException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Which is the difference between Java 11 and Java 8. As far as I can tell from looking at the build, the whole thing should compile with Java 8, and when I build it locally with Corretto 1.8 it all works. Am I missing something obvious to you?

@jeromevdl
Copy link
Contributor

jeromevdl commented Jun 25, 2023

Parameters example fails with:

Error:  Failed to execute goal dev.aspectj:aspectj-maven-plugin:1.13.1:compile (default) on project powertools-examples-core: Execution default of goal dev.aspectj:aspectj-maven-plugin:1.13.1:compile failed: An API incompatibility was encountered while executing dev.aspectj:aspectj-maven-plugin:1.13.1:compile: java.lang.UnsupportedClassVersionError: org/eclipse/core/runtime/OperationCanceledException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Which is the difference between Java 11 and Java 8. As far as I can tell from looking at the build, the whole thing should compile with Java 8, and when I build it locally with Corretto 1.8 it all works. Am I missing something obvious to you?

This is exactly why I wanted to get samples autonomous... So that we can see this kind of things. This is the same error I had in end-to-end tests. You need to enforce the version 1.9.7 of aspecttools or aspectjrt, look at the e2e pom.

@codecov-commenter
Copy link

codecov-commenter commented Jun 26, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (0dac6fe) 70.87% compared to head (6381c04) 70.87%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1240   +/-   ##
=========================================
  Coverage     70.87%   70.87%           
  Complexity      541      541           
=========================================
  Files            72       72           
  Lines          2328     2328           
  Branches        254      254           
=========================================
  Hits           1650     1650           
  Misses          558      558           
  Partials        120      120           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@scottgerring
Copy link
Contributor Author

@jeromevdl have I missed anything?

  • Readme updated
  • Projects build and weave independently for all java versions
  • Breaking interfaces in powertools projects immediately fails build for examples

You had a comment on the ticket that I've not done anything with that I might've missed the significance of:

and change package with install to keep this "dependency"

@scottgerring scottgerring marked this pull request as ready for review June 26, 2023 09:02
Copy link
Contributor

@jeromevdl jeromevdl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just suggesting to add a comment on the fact that profiles are not really required by developers. You can probably write it with better english ;)

@jeromevdl
Copy link
Contributor

You had a comment on the ticket that I've not done anything with that I might've missed the significance of:

and change package with install to keep this "dependency"

@scottgerring, I was mentioning we should change the mvn package to mvn install so that examples will take the "installed" versions of powertools (locally), not the one in maven central. Thus we keep the dependency, and samples can fail if there is something wrong in the new version of Powertools.

@scottgerring
Copy link
Contributor Author

@jeromevdl cleaned up comments and changed github CI build to run install

@scottgerring scottgerring requested a review from jeromevdl June 26, 2023 15:32
@jeromevdl
Copy link
Contributor

You didn't like my comments ? maybe you can reformulate but I think we should say they don't really need the profiles, but just to take the dependency...

…es-builds' into fix-decouple-examples-builds
@scottgerring
Copy link
Contributor Author

scottgerring commented Jun 27, 2023

You didn't like my comments ? maybe you can reformulate but I think we should say they don't really need the profiles, but just to take the dependency...

my bad; I failed to push the commit resolving this yesterday before resolving the threads 🤦 I expanded on the profile xmldoc in each example like this:

  <!-- Use a profile to enforce AspectJ version 1.9.7 if we are Java 1.8 otherwise we'll get class
             version mismatch issues. All subsequent Java releases build with the default AspectJ configuration
              on the project.

              Note:
              - if you are running Java > 1.8, you can remove this profile altogether
              - If you are running on Java 1.8, you should apply the aspectJ version here to the project, and remove
                the profile.
              -->

Copy link
Contributor

@jeromevdl jeromevdl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for me

@jeromevdl jeromevdl merged commit f30407c into main Jun 27, 2023
@jeromevdl jeromevdl deleted the fix-decouple-examples-builds branch June 27, 2023 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants