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
base: main
Are you sure you want to change the base?
Conversation
2fed8d0
to
ddd20ea
Compare
gradle-enterprise-conventions-maven-extension/extension/src/main/java/com/example/CiUtils.java
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/extension/pom.xml
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/extension/README.md
Outdated
Show resolved
Hide resolved
2e47869
to
591f7a7
Compare
gradle-enterprise-conventions-maven-extension/example-builds/maven_3.6.x/.mvn/extensions.xml
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/extension/.mvn/extensions.xml
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/extension/.mvn/gradle-enterprise.xml
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/extension/src/main/java/com/example/CiUtils.java
Outdated
Show resolved
Hide resolved
...ntions-maven-extension/extension/src/main/java/com/example/CustomGradleEnterpriseConfig.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments
gradle-enterprise-conventions-maven-extension/example-builds/maven_3.6.x/pom.xml
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/example-builds/maven_3.6.x/pom.xml
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/example-builds/maven_3.9.x/pom.xml
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/extension/.mvn/extensions.xml
Outdated
Show resolved
Hide resolved
gradle-enterprise-conventions-maven-extension/extension/.mvn/gradle-enterprise.xml
Outdated
Show resolved
Hide resolved
* 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
...conventions-maven-extension/example-builds/maven_3.6.x/.mvn/wrapper/maven-wrapper.properties
Outdated
Show resolved
Hide resolved
@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. |
4329f7f
to
d97f488
Compare
...le-enterprise-conventions-maven-extension/extension/src/main/resources/gradle-enterprise.xml
Outdated
Show resolved
Hide resolved
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Lines 62 to 64 in 4e67808
- 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
f227520
to
573db6b
Compare
...sion/extension/src/main/java/com/myorg/ConventionGradleEnterpriseMavenExtensionListener.java
Outdated
Show resolved
Hide resolved
This needs some attention. I'm going to close it but leave the branch around for now until we want to prioritize it again. |
9a1dace
to
75f60b7
Compare
<?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"> |
There was a problem hiding this comment.
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.
develocity-build-config-samples/common-develocity-maven-configuration/.mvn/extensions.xml
Line 1 in 7bba437
<?xml version="1.0" encoding="UTF-8"?> |
<?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"?> |
1e7ce45
to
f4cc495
Compare
f4cc495
to
19e0948
Compare
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.