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 Convention Develocity Maven extension #636

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

clayburn
Copy link
Member

@clayburn clayburn commented Mar 17, 2023

This PR adds a sample Maven extension that applies Develocity, Common Custom User Data Maven extension, and a reasonable set of defaults for configuring build scans and build caching. The goal is to provide a sample that makes it simple for organizations to create and host their own, customized version of this extension in order to more easily and consistently apply Develocity configurations across an organization.

@clayburn clayburn force-pushed the cj/convention-maven-extension branch from 2fed8d0 to ddd20ea Compare March 17, 2023 19:39
@clayburn clayburn force-pushed the cj/convention-maven-extension branch from 2e47869 to 591f7a7 Compare March 20, 2023 14:00
@clayburn clayburn marked this pull request as ready for review March 20, 2023 19:05
Copy link
Member

@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.

i agree with what Daz said about trying to dogfood this extension.

.github/dependabot.yml Outdated Show resolved Hide resolved
gradle-enterprise-conventions-maven-extension/README.md Outdated Show resolved Hide resolved
Copy link
Member

@jprinet jprinet left a comment

Choose a reason for hiding this comment

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

Some minor comments

* Update `isCi` in [CiUtils.java](extension/src/main/java/com/example/CiUtils.java) and the CI checks in the [Gradle Enterprise configuration](extension/.mvn/gradle-enterprise.xml) to properly detect your CI environment
* Update the server URL to your own Gradle Enterprise instance in the [Gradle Enterprise configuration](extension/.mvn/gradle-enterprise.xml) and [CustomGradleEnterpriseConfig.java](extension/src/main/java/com/example/CustomGradleEnterpriseConfig.java)
* Add any common tags, links, or values to [CustomGradleEnterpriseConfig.java](extension/src/main/java/com/example/CustomGradleEnterpriseConfig.java)
* Deploy the extension to your own artifact repository
Copy link
Member

Choose a reason for hiding this comment

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

Can maven extensions also be fetched from custom artifact repositories? Or do they only fetch from Maven central? I don't know the answer here but I am wondering since maven extensions are loaded possibly before artifact repositories can be set.

Copy link
Member Author

Choose a reason for hiding this comment

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

I ran a test where I cleared maven local, deployed to a non-maven local file repo, and it was able to resolve from there when I declared that directory as a repository.

It seems to respect the repository definitions in the POM file and resolve extensions from those. It's hinted at in this documentation. I do think it would be good to be explicit about that in this README.

Copy link
Member

Choose a reason for hiding this comment

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

We should do a full e2e test of this using a real repository. I wonder if we could publish to https://repo.grdev.net/ for a test. I have had one customer report problems with this. But I have another customer who hasn't.

@etiennestuder
Copy link
Member

etiennestuder commented Mar 21, 2023

@clayburn I have not gotten to review this, yet, but please make sure all of this runs on Java 8, incl. the build itself. Similarly, the approach of this convention should work on Maven 3.6, 3.7, 3.8, and 3.9. thanks.

@clayburn clayburn force-pushed the cj/convention-maven-extension branch from 4329f7f to d97f488 Compare March 21, 2023 13:28
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
- name: Verify Example Build
run: ./mvnw clean verify -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com
Copy link
Member

Choose a reason for hiding this comment

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

Is the intention here to check that the convention extension has been applied to the build?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a rudimentary check just to make sure that the build succeeds with the convention extension. It won't actually verify the extension has been applied I suppose.

Copy link
Member

Choose a reason for hiding this comment

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

It could be a nice improvement.
I can think of a custom extension creating a dummy file for which presence would be checked to assess E2E validation.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a good idea. I will look into adding something like that

Copy link
Member

Choose a reason for hiding this comment

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

For Gradle I added a check that a build scan was published. The setup-gradle action makes this very easy.

- name: Verify Build Scan published
if: ${{ !steps.build.outputs.build-scan-url }}
run: echo "::error ::No Build Scan published"; exit 1

It would be nice if maven-setup could do the same. https://github.com/gradle/develocity-actions/tree/main/maven-setup

@clayburn clayburn force-pushed the cj/convention-maven-extension branch 3 times, most recently from f227520 to 573db6b Compare August 14, 2023 20:09
@clayburn
Copy link
Member Author

This needs some attention. I'm going to close it but leave the branch around for now until we want to prioritize it again.

@clayburn clayburn closed this May 14, 2024
@erichaagdev erichaagdev reopened this May 16, 2024
@erichaagdev erichaagdev force-pushed the cj/convention-maven-extension branch from 9a1dace to 75f60b7 Compare May 16, 2024 18:10
@erichaagdev erichaagdev changed the title Add Gradle Enterprise Convention Maven Extension Add Develocity Convention Maven Extension May 16, 2024
@erichaagdev erichaagdev changed the title Add Develocity Convention Maven Extension Add Convention Develocity Maven extension May 16, 2024
Comment on lines 1 to 3
<?xml version="1.0" encoding="UTF-8"?>
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
Copy link
Member

Choose a reason for hiding this comment

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

@clayburn do we need this, or can we align it with the common configuration sample? IntelliJ doesn't seem to like it and I'm not sure what the purpose is.

image

Suggested change
<?xml version="1.0" encoding="UTF-8"?>
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<?xml version="1.0" encoding="UTF-8"?>

@erichaagdev erichaagdev force-pushed the cj/convention-maven-extension branch 2 times, most recently from 1e7ce45 to f4cc495 Compare May 16, 2024 21:42
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.

None yet

7 participants