Skip to content
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

Add support for the renamed Develocity Maven Extension #624

Merged
merged 9 commits into from
Jun 14, 2024

Conversation

jthurne
Copy link
Member

@jthurne jthurne commented May 28, 2024

The Gradle Enterprise Maven Extension was renamed to the Develocity Maven
Extension in version 1.21. The API was also updated for hte product name
change. Unfortunately, this broke compatibility with the Build Validation
Scripts. This commit fixes the incompatibility.

The fix works by updating the configure-gradle-enterprise-maven-extension to
define and register two listeners: a GradleEnterpriseListener and a
DevelocityListener. If an older version of the Gradle Enterprise Maven
Extension is used, it will load the GradleEnterpriseListener. If a newer
version of the Develocity Maven Extension is used, then it will load the
DevelocityListener. The Develocity Maven Extension Adapters are used to
eliminate duplication between the two different listeners.

To ensure compatibility with older verisons of Maven, this PR also
updates the extension to be compiled against an earlier version of
maven-core.

The Gradle Enterprise Maven Extension was renamed to the Develocity Maven
Extension in version 1.21.  The API was also updated for hte product name
change. Unfortunately, this broke compatibility with the Build Validation
Scripts. This commit fixes the incompatibility.

The fix works by updating the configure-gradle-enterprise-maven-extension to
define and register two listeners: a GradleEnterpriseListener and a
DevelocityListener.  If an older version of the Gradle Enterprise Maven
Extension is used, it will load the GradleEnterpriseListener.  If a newer
version of the Develocity Maven Extension is used, then it will load the
DevelocityListener. The Develocity Maven Extension Adapters are used to
eliminate duplication between the two different listeners.

The develocity-maven-extention-adapters jar has to be added to the Maven
extension classpath.  The Bash scripts were updated to do so, and the Gradle
build scripts were updated to inject the adaptor version into the Bash scripts.

ALternatively, we could:
  1. Create a fat jar containing the listeners and the adapters

  2. Update the bash scripts to search the maven lib dir for the jar, and
     use the latest one it finds.
...to ensure compatibility with older versions of Maven.
…maven-extension

* origin/main:
  Bump org.apache.maven:maven-core from 3.9.6 to 3.9.7
@jthurne jthurne requested a review from erichaagdev May 28, 2024 15:42
@jthurne jthurne changed the title Add support for the renamed Deelocity Maven Extension Add support for the renamed Develocity Maven Extension May 28, 2024
Copy link
Contributor

@runningcode runningcode left a comment

Choose a reason for hiding this comment

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

just a small question otherwise looks good.

Unused warnings were previously suppressed because the main classes aren't used
directly. However, this suppressed other unused warnings and hid a few things
that are not actually used.  So this commit unsupresses unused warnings and
removes the unused variables and parameters.

The attempt to suppress deprecation warnigns on the ConfigureGradleEnterprise
class wasn't working because the deprecated classes are referenced in import
statements. The class was updated to use the fully qualified name of the
deprecated classes.
@jthurne jthurne requested a review from erichaagdev May 29, 2024 17:51
Copy link
Member

@erichaagdev erichaagdev left a comment

Choose a reason for hiding this comment

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

I did some testing and everything checks out. Here are the scenarios I ran:

image

The column in red shows what the build has applied already.

I even went so far as to update the scripts to inject DV 1.21.4, based off of this branch, and everything worked as expected.

jthurne and others added 2 commits June 14, 2024 11:30
Co-authored-by: Brian Demers <brian.demers@gmail.com>
Signed-off-by: Jim Hurne <jhurne@gradle.com>
…maven-extension

* origin/main:
  Bump com.google.guava:guava from 33.2.0-jre to 33.2.1-jre
  Bump Gradle Wrapper from 8.7 to 8.8
@jthurne jthurne merged commit 1ced0d6 into main Jun 14, 2024
5 checks passed
@jthurne jthurne deleted the jhurne/support-newer-maven-extension branch June 14, 2024 18:08
jthurne added a commit that referenced this pull request Jun 14, 2024
* origin/main:
  Add support for the renamed Develocity Maven Extension (#624)
jthurne added a commit that referenced this pull request Jun 14, 2024
The Gradle Enterprise Maven Extension was renamed to the Develocity Maven
Extension in version 1.21.  The API was also updated for the product name
change. Unfortunately, this broke compatibility with the Build Validation
Scripts. This commit fixes the incompatibility.

The fix works by updating the configure-gradle-enterprise-maven-extension to
define and register two listeners: a GradleEnterpriseListener and a
DevelocityListener.  If an older version of the Gradle Enterprise Maven
Extension is used, it will load the GradleEnterpriseListener.  If a newer
version of the Develocity Maven Extension is used, then it will load the
DevelocityListener. The Develocity Maven Extension Adapters are used to
eliminate duplication between the two different listeners.

This commit also creates a "fat jar" so that the develocity-maven-extention-adapters jar
does not have to be manually added to the classpath.

The project compiles agianst an older version of Maven to ensure compatibility
with projects using an older version of Maven.

**Remove unused variables and suppress deprecation warnings**

Unused warnings were previously suppressed because the main classes aren't used
directly. However, this suppressed other unused warnings and hid a few things
that are not actually used.  So this commit un-supresses unused warnings and
removes the unused variables and parameters.

The attempt to suppress deprecation warnings on the ConfigureGradleEnterprise
class wasn't working because the deprecated classes are referenced in import
statements. The class was updated to use the fully qualified name of the
deprecated classes.

---------

Signed-off-by: Jim Hurne <jhurne@gradle.com>
Co-authored-by: Eric Haag <ehaag@gradle.com>
Co-authored-by: Brian Demers <brian.demers@gmail.com>
jthurne added a commit that referenced this pull request Jun 14, 2024
* origin/main:
  Add support for the renamed Develocity Maven Extension (#624)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants