Skip to content

Commit 8a28eb6

Browse files
Migrate build infrastructure from Gradle to Maven
- Add pom.xml with all dependencies, compiler settings (Java 1.8, -parameters), jar manifest (Automatic-Module-Name), javadoc, source, and GPG signing profile - Add Maven wrapper (mvnw/mvnw.cmd) replacing Gradle wrapper - Rename gradle-build.yml to maven-build.yml with Maven commands and cache - Update codeql-analysis.yml to use mvnw compile - Update ADO ci-build.yml with Maven install/deploy and settings.xml auth - Update ADO daily-ci-build.yml with Maven@4 task and network-isolated mirror - Update dependabot.yml: maven ecosystem for root, gradle kept for /android - Update .gitignore: swap Gradle entries for Maven - Update release-please-config.json: XML xpath updater for pom.xml version - Inline dependencies into android/build.gradle (remove shared gradle/dependencies.gradle) - Remove all root Gradle files and java-8/ sub-project Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ea0951f commit 8a28eb6

26 files changed

Lines changed: 896 additions & 845 deletions

.azure-pipelines/ci-build.yml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,61 @@ extends:
6060
Copy-Item $(downloadLocalProperties.secureFilePath) local.properties -Verbose
6161
displayName: Copy secring and 'local.properties'
6262
63-
- script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
63+
- pwsh: |
64+
$props = Get-Content local.properties -Raw
65+
$keyId = ($props | Select-String -Pattern 'signing\.keyId=(.+)').Matches.Groups[1].Value
66+
$keyRingFile = ($props | Select-String -Pattern 'signing\.secretKeyRingFile=(.+)').Matches.Groups[1].Value
67+
$keyPassword = ($props | Select-String -Pattern 'signing\.password=(.+)').Matches.Groups[1].Value
68+
69+
$settingsXml = @"
70+
<settings>
71+
<servers>
72+
<server>
73+
<id>GraphDeveloperExperiencesPublic</id>
74+
<username>microsoftgraph</username>
75+
<password>${{ variables.ARTIFACTS_PAT }}</password>
76+
</server>
77+
</servers>
78+
<profiles>
79+
<profile>
80+
<id>signing</id>
81+
<properties>
82+
<gpg.keyname>$keyId</gpg.keyname>
83+
<gpg.passphrase>$keyPassword</gpg.passphrase>
84+
</properties>
85+
</profile>
86+
</profiles>
87+
</settings>
88+
"@
89+
$settingsDir = Join-Path $HOME ".m2"
90+
New-Item -ItemType Directory -Path $settingsDir -Force | Out-Null
91+
$settingsXml | Set-Content (Join-Path $settingsDir "settings.xml") -Encoding UTF8
92+
displayName: Configure Maven settings
93+
94+
- script: ./mvnw install -Psigning --no-transfer-progress -DmavenCentralSnapshotSuffix=""
6495
displayName: Publish to local Maven for verification
6596
condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
6697

67-
- script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true
98+
- script: ./mvnw install -Psigning --no-transfer-progress
6899
displayName: Publish to local Maven for verification
69100
condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
70101

71-
- script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
72-
displayName: Publish to local Maven ADO for ESRP
102+
- script: ./mvnw deploy -Psigning --no-transfer-progress -DmavenCentralSnapshotSuffix="" -DaltDeploymentRepository=ADO::default::file://$(Build.SourcesDirectory)/target/staging-deploy
103+
displayName: Stage artifacts for ESRP
73104
condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
74105

75-
- script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true
76-
displayName: Publish to local Maven ADO for ESRP
106+
- script: ./mvnw deploy -Psigning --no-transfer-progress -DaltDeploymentRepository=ADO::default::file://$(Build.SourcesDirectory)/target/staging-deploy
107+
displayName: Stage artifacts for ESRP
77108
condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
78109

79110
- pwsh: |
80-
$contents = Get-Content gradle.properties -Raw
81-
$major = $contents | Select-String -Pattern 'mavenMajorVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
82-
$minor = $contents | Select-String -Pattern 'mavenMinorVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
83-
$patch = $contents | Select-String -Pattern 'mavenPatchVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
111+
$pomXml = [xml](Get-Content pom.xml)
112+
$version = $pomXml.project.version
84113
$snapshot_suffix = if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) { '' } else { '-SNAPSHOT' }
85-
$version = "$major.$minor.$patch$snapshot_suffix"
114+
# If version already contains -SNAPSHOT and we're on a tag, strip it
115+
if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) {
116+
$version = $version -replace '-SNAPSHOT$', ''
117+
}
86118
echo "Current version is $version"
87119
echo "##vso[task.setvariable variable=PACKAGE_VERSION;]$version"
88120
displayName: Get current version
@@ -95,7 +127,7 @@ extends:
95127
displayName: Inspect contents of local Maven cache
96128
97129
- pwsh: |
98-
$packageFullPath = Join-Path -Path "./" -ChildPath "build/publishing-repository/com/microsoft/graph/microsoft-graph" -AdditionalChildPath "$(PACKAGE_VERSION)"
130+
$packageFullPath = Join-Path -Path "./target/staging-deploy" -ChildPath "com/microsoft/graph/microsoft-graph" -AdditionalChildPath "$(PACKAGE_VERSION)"
99131
echo "Package full path: $packageFullPath"
100132
echo "##vso[task.setvariable variable=PACKAGE_PATH;]$packageFullPath"
101133
displayName: Get the package full path

.azure-pipelines/daily-ci-build.yml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,44 @@ extends:
4343
- checkout: self
4444
submodules: recursive
4545

46-
- script: |
47-
sed -i "/mavenCentral()/d" build.gradle
48-
sed -i "/gradlePluginPortal()/d" settings.gradle
49-
sed -i "/mavenCentral()/d" settings.gradle
50-
displayName: Strip plugins and public repos for network-isolated build
46+
- task: JavaToolInstaller@1
47+
inputs:
48+
versionSpec: '17'
49+
jdkArchitectureOption: 'x64'
50+
jdkSourceOption: 'PreInstalled'
51+
52+
- pwsh: |
53+
$settingsXml = @"
54+
<settings>
55+
<servers>
56+
<server>
57+
<id>GraphDeveloperExperiencesPublic</id>
58+
<username>microsoftgraph</username>
59+
<password>$(ARTIFACTS_PAT)</password>
60+
</server>
61+
</servers>
62+
<mirrors>
63+
<mirror>
64+
<id>GraphDeveloperExperiencesPublic</id>
65+
<mirrorOf>central</mirrorOf>
66+
<url>https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/GraphDeveloperExperiences_Public/maven/v1</url>
67+
</mirror>
68+
</mirrors>
69+
</settings>
70+
"@
71+
$settingsDir = Join-Path $HOME ".m2"
72+
New-Item -ItemType Directory -Path $settingsDir -Force | Out-Null
73+
$settingsXml | Set-Content (Join-Path $settingsDir "settings.xml") -Encoding UTF8
74+
displayName: Configure Maven settings for network-isolated build
5175
52-
- task: Gradle@4
76+
- task: Maven@4
5377
displayName: Build and Test SDK
5478
inputs:
55-
gradleWrapperFile: 'gradlew'
56-
workingDirectory: '$(Build.SourcesDirectory)'
57-
tasks: 'assemble test'
58-
options: '--no-daemon -PGraphDeveloperExperiencesPublicPassword=$(ARTIFACTS_PAT)'
79+
mavenPomFile: 'pom.xml'
80+
goals: 'verify'
81+
options: '--no-transfer-progress'
5982
publishJUnitResults: true
60-
testResultsFiles: '**/TEST-*.xml'
83+
testResultsFiles: '**/surefire-reports/TEST-*.xml'
6184
javaHomeOption: 'JDKVersion'
6285
jdkVersionOption: '1.17'
6386
jdkArchitectureOption: 'x64'

.github/dependabot.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
version: 2
22
updates:
3-
- package-ecosystem: gradle
4-
directories:
5-
- "/"
6-
- "/java-8"
7-
- "/android"
3+
- package-ecosystem: maven
4+
directory: "/"
85
schedule:
96
interval: daily
107
time: "09:00" # 9am UTC
@@ -16,12 +13,14 @@ updates:
1613
microsoft-graph:
1714
patterns:
1815
- "*microsoft-graph*"
19-
junit-dependencies:
20-
patterns:
21-
- "*junit*"
22-
open-telemetry:
23-
patterns:
24-
- "*opentelemetry*"
16+
- package-ecosystem: gradle
17+
directories:
18+
- "/android"
19+
schedule:
20+
interval: daily
21+
time: "09:00" # 9am UTC
22+
open-pull-requests-limit: 10
23+
groups:
2524
android-build-tools:
2625
patterns:
2726
- "*android*"

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
with:
5050
java-version: 21
5151
distribution: 'temurin'
52-
cache: gradle
52+
cache: maven
5353

5454
# Initializes the CodeQL tools for scanning.
5555
- name: Initialize CodeQL
@@ -75,10 +75,8 @@ jobs:
7575
# If the Autobuild fails above, remove it and uncomment the following three lines.
7676
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
7777

78-
- name: Grant execute permission for gradlew
79-
run: chmod +x gradlew
80-
- name: Build with Gradle
81-
run: ./gradlew --no-build-cache build
78+
- name: Build with Maven
79+
run: ./mvnw compile --no-transfer-progress -DskipTests
8280

8381
- name: Perform CodeQL Analysis
8482
uses: github/codeql-action/analyze@v4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Gradle Build and Compare Package
1+
name: Maven Build
22

33
on:
44
push:
@@ -17,36 +17,29 @@ jobs:
1717
with:
1818
java-version: 21
1919
distribution: 'temurin'
20-
cache: gradle
20+
cache: maven
2121
- name: Move generated sources to correct package
2222
run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\generated'
2323
shell: pwsh
24-
- name: Grant Execute permission for gradlew
25-
run: chmod +x gradlew
26-
- name: Build with Gradle
27-
run: ./gradlew build
24+
- name: Build with Maven
25+
run: ./mvnw verify --no-transfer-progress
2826
- name: Upload Unit Test Results
2927
if: ${{ always() }}
3028
uses: actions/upload-artifact@v7
3129
with:
3230
name: UnitTests
3331
path: |
34-
build/reports/tests/test/**
35-
build/test-results/**
32+
target/surefire-reports/**
3633
- name: Upload a Build Artifact
3734
uses: actions/upload-artifact@v7
3835
with:
3936
name: drop
4037
path: |
41-
**/libs/*
42-
build/generated-pom.xml
43-
build/generated-pom.xml.asc
44-
build.gradle
45-
gradlew
46-
gradlew.bat
47-
settings.gradle
48-
gradle.properties
49-
**/gradle/**
38+
target/*.jar
39+
pom.xml
40+
mvnw
41+
mvnw.cmd
42+
.mvn/**
5043
scripts/**
5144
5245
build-java-8:
@@ -58,15 +51,12 @@ jobs:
5851
with:
5952
java-version: 8
6053
distribution: 'temurin'
61-
cache: gradle
54+
cache: maven
6255
- name: Move generated sources to correct package
6356
run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\generated'
6457
shell: pwsh
65-
- name: Grant Execute permission for gradlew
66-
run: chmod +x gradlew
6758
- name: Build with Java 8
68-
working-directory: ./java-8
69-
run: .././gradlew build
59+
run: ./mvnw compile --no-transfer-progress
7060

7161
build:
7262
needs: [build-java-latest, build-java-8]
@@ -81,19 +71,3 @@ jobs:
8171
exit 1
8272
fi
8373
84-
dependency-submission:
85-
runs-on: ubuntu-latest
86-
if: github.event_name == 'push'
87-
permissions:
88-
contents: write
89-
steps:
90-
- uses: actions/checkout@v6
91-
- name: Set up JDK
92-
uses: actions/setup-java@v5
93-
with:
94-
java-version: 21
95-
distribution: 'temurin'
96-
cache: gradle
97-
- name: Generate and submit dependency graph
98-
uses: gradle/actions/dependency-submission@v6
99-

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@
2020

2121
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2222
hs_err_pid*
23-
/.gradle/
24-
/build/
25-
/bin/
23+
24+
# Maven
25+
/target/
26+
27+
# Maven wrapper
28+
!.mvn/wrapper/maven-wrapper.jar
2629

2730
#Eclipse
2831
.project
2932
.classpath
3033
.settings
3134

32-
# Maven
33-
/target/
3435
local.properties
3536
.idea

.mvn/wrapper/maven-wrapper.jar

61.6 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar

android/build.gradle

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,17 @@ android {
7171
}
7272
}
7373

74-
apply from: "../gradle/dependencies.gradle"
74+
75+
dependencies {
76+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
77+
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
78+
79+
api 'com.microsoft.graph:microsoft-graph-core:3.6.6'
80+
81+
implementation 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.9.2'
82+
implementation 'com.microsoft.kiota:microsoft-kiota-http-okHttp:1.9.2'
83+
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-json:1.9.2'
84+
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-text:1.9.2'
85+
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-form:1.9.2'
86+
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-multipart:1.9.2'
87+
}

0 commit comments

Comments
 (0)