From 027f6a621c14e3d845b1e60b09f2e22dcb4e8c34 Mon Sep 17 00:00:00 2001
From: Bruce Jin <jtyself@amazon.com>
Date: Tue, 16 Apr 2024 14:30:42 +0000
Subject: [PATCH] remove aws maven setting, use git-commit-id-maven-plugin in
 common pom.

---
 pom.xml                                       |  6 +-
 provider/indexer-aws/build-aws/buildspec.yaml |  6 +-
 provider/indexer-aws/maven/settings.xml       | 91 -------------------
 3 files changed, 5 insertions(+), 98 deletions(-)
 delete mode 100644 provider/indexer-aws/maven/settings.xml

diff --git a/pom.xml b/pom.xml
index 6119ac280..6aa0646cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -236,9 +236,9 @@
 
         <plugins>
             <plugin>
-                <groupId>pl.project13.maven</groupId>
-                <artifactId>git-commit-id-plugin</artifactId>
-                <version>4.0.5</version>
+                <groupId>io.github.git-commit-id</groupId>
+                <artifactId>git-commit-id-maven-plugin</artifactId>
+                <version>8.0.2</version>
                 <executions>
                     <execution>
                         <goals>
diff --git a/provider/indexer-aws/build-aws/buildspec.yaml b/provider/indexer-aws/build-aws/buildspec.yaml
index 57113ed35..6af561f95 100644
--- a/provider/indexer-aws/build-aws/buildspec.yaml
+++ b/provider/indexer-aws/build-aws/buildspec.yaml
@@ -39,9 +39,7 @@ phases:
       - mvn -version
       - echo $JAVA_HOME #WHY
       - mkdir -p /root/.m2
-      - cp ./provider/indexer-aws/maven/settings.xml /root/.m2/settings.xml # copy the AWS-specific settings.xml to the CodeBuild instance's .m2 folder
-      - export AWS_ACCOUNT_ID=`aws sts get-caller-identity | grep Account | cut -d':' -f 2 | cut -d'"' -f 2`
-      - export AWS_OSDU_DEV_MAVEN_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain $AWS_OSDU_DEV_MAVEN_DOMAIN --domain-owner $AWS_ACCOUNT_ID --query authorizationToken --output text`
+      - cp ./.mvn/community-maven.settings.xml /root/.m2/settings.xml
       # Install git secrets
       - git clone https://github.com/awslabs/git-secrets.git
       - cd git-secrets && make install && cd ..
@@ -74,7 +72,7 @@ phases:
 
       - echo "Building primary service assemblies..."
       - mvn -ntp -B test install -pl .,indexer-core,provider/indexer-aws -Ddeployment.environment=prod  
-      - mvn sonar:sonar -pl .,provider/indexer-aws -Dsonar.login=${SONAR_USERNAME} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.branch.name=${BRANCH_NAME}
+      - mvn sonar:sonar -pl .,provider/indexer-aws -Dsonar.login=${SONAR_USERNAME} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.host.url=${SONAR_URL}
 
       - echo "Building integration testing assemblies and gathering artifacts..."
       - ./testing/indexer-test-aws/build-aws/prepare-dist.sh
diff --git a/provider/indexer-aws/maven/settings.xml b/provider/indexer-aws/maven/settings.xml
deleted file mode 100644
index 3bd1cd4aa..000000000
--- a/provider/indexer-aws/maven/settings.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.​
-Licensed 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.
-
--->
-
-<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
-          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
-
-    <profiles>
-        <profile>
-            <id>aws-osdu-dev-maven</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <repositories>
-                <repository>
-                    <id>aws-osdu-dev-maven</id>
-                    <url>${env.AWS_OSDU_DEV_MAVEN_URL}</url>
-                </repository>
-                <repository>
-                    <id>gitlab-os-core-common-maven</id>
-                    <url>https://community.opengroup.org/api/v4/projects/67/packages/maven</url>
-                </repository>
-                <repository>
-                    <id>gitlab-os-core-lib-aws-maven</id>
-                    <url>https://community.opengroup.org/api/v4/projects/68/packages/maven</url>
-                </repository>
-            </repositories>
-        </profile>
-        <profile>
-            <id>credentialsConfiguration</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <properties>
-                <deployment.environment>dev</deployment.environment>
-                <aws.accessKeyId>no-default</aws.accessKeyId>
-                <aws.secretKey>no-default</aws.secretKey>
-                <azure.devops.username>Another-Access-Token-2021</azure.devops.username>
-                <azure.devops.token>no-default</azure.devops.token>
-            </properties>
-        </profile>
-        <profile>
-            <id>sonar</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <properties>
-                <sonar.host.url>
-                    ${env.SONAR_URL}
-                </sonar.host.url>
-            </properties>
-        </profile>
-    </profiles>
-
-    <servers>
-        <server>
-            <id>aws-osdu-dev-maven</id>
-            <username>aws</username>
-            <password>${env.AWS_OSDU_DEV_MAVEN_AUTH_TOKEN}</password>
-        </server>
-    </servers>
-
-    <mirrors>
-        <mirror>
-            <id>aws-osdu-dev-maven</id>
-            <name>aws-osdu-dev-maven</name>
-            <url>https://osdu-dev-${AWS_ACCOUNT_ID}.d.codeartifact.us-east-1.amazonaws.com/maven/osdu-maven/</url>
-            <mirrorOf>central,!gitlab-os-core-common-maven,!gitlab-os-core-lib-aws-maven</mirrorOf>
-        </mirror>
-    </mirrors>
-
-    <activeProfiles>
-        <activeProfile>credentialsConfiguration</activeProfile>
-    </activeProfiles>
-
-</settings>
\ No newline at end of file
-- 
GitLab