Skip to content

Commit

Permalink
Add Convention Develocity Maven extension
Browse files Browse the repository at this point in the history
  • Loading branch information
clayburn authored and erichaagdev committed May 16, 2024
1 parent 7bba437 commit 75f60b7
Show file tree
Hide file tree
Showing 22 changed files with 1,471 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ updates:
time: "02:00"
ignore:
- dependency-name: "com.gradle:build-scan-plugin"
versions: [ "1.16" ]
- package-ecosystem: "maven"
directory: "convention-develocity-maven-extension/extension"
schedule:
interval: "daily"
time: "02:00"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/convention-gradle-enterprise-maven-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Verify Maven Convention Extension

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
build:
name: Build Gradle Enterprise Conventions Maven Extension
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Build Gradle Enterprise Conventions Maven Extension
run: ./mvnw clean install -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com
working-directory: convention-gradle-enterprise-maven-extension/extension
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
- name: Upload extension
uses: actions/upload-artifact@v3
with:
name: convention-gradle-enterprise-maven-extension
path: ~/.m2/repository/com/myorg/convention-gradle-enterprise-maven-extension
verification:
name: Verify Example Build for Maven ${{ matrix.maven-version }}
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
maven-version: ['3.6.3', '3.8.8', '3.9.1']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Download Extension
uses: actions/download-artifact@v3
with:
name: convention-gradle-enterprise-maven-extension
path: ~/.m2/repository/com/myorg/convention-gradle-enterprise-maven-extension
- name: Set Maven Version
run: ./mvnw wrapper:wrapper -Dmaven=${{ matrix.maven-version }} -Dgradle.enterprise.url=https://ge.solutions-team.gradle.com
working-directory: convention-gradle-enterprise-maven-extension/example
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
working-directory: convention-gradle-enterprise-maven-extension/example
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
3 changes: 3 additions & 0 deletions convention-gradle-enterprise-maven-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target/
dependency-reduced-pom.xml
**/.mvn/.gradle-enterprise/gradle-enterprise-workspace-id
36 changes: 36 additions & 0 deletions convention-gradle-enterprise-maven-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## Convention Gradle Enterprise Maven Extension

This project demonstrates how a convention extension can share the same Gradle Enterprise build configuration across multiple projects. It
is intended to serve as a starting point for creating your own Maven extension that applies your specific Gradle Enterprise configuration. Note
the inline comments in the build and source code for things to adjust specifically to your needs.

### Content

This project is structured as follows:

* `extension` - Contains the convention extension
* `example` - Contains an example build that applies the convention extension

### Running the example builds

Before running the example build, install the convention extension to your local Maven repository.

```bash
cd extension
./mvnw clean install
```

Once the extension is published, you can run the example build under `example`:

```bash
cd example
./mvnw clean verify
```

Note that you would publish your convention extension to your internal artifact provider, e.g., Artifactory or Nexus, for
production usage. The artifact provider must be configured as a [Mirror](https://maven.apache.org/guides/mini/guide-mirror-settings.html)
to Maven Central in order to correctly resolve the extension.

#### Requirements

To run the example build, use Java 8.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bat text eol=crlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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">
<extension>
<groupId>com.myorg</groupId>
<artifactId>convention-gradle-enterprise-maven-extension</artifactId>
<version>1.0.0-SNAPSHOT</version>
</extension>
</extensions>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

0 comments on commit 75f60b7

Please sign in to comment.