Skip to content

Commit ef46a90

Browse files
authored
Update pom.xml add javax.mail
* Update pom.xml add javax.mail * Rename SonarQubeAnalysis.yml to SonarQubeAnalysis.yml * Create SonarCloudCodeAnalysis.yml * Update SonarCloudCodeAnalysis.yml * Update SonarCloudCodeAnalysis.yml
1 parent cfa0240 commit ef46a90

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: SonarCloudCodeAnalysis
2+
permissions:
3+
contents: read
4+
5+
on:
6+
push:
7+
branches: [ dev, main, dependabot, aa ] # 在推送到主干分支时触发
8+
pull_request:
9+
branches: [ dev, main, dependabot, aa ] # 在任何针对主干分支的PR创建时触发
10+
11+
12+
jobs:
13+
build-and-scan:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # SonarScanner可能需要完整的提交历史
20+
21+
- name: Set up JDK
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '21' # 或你的项目使用的JDK版本
25+
distribution: 'temurin'
26+
27+
- name: Cache Maven dependencies
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/.m2/repository
31+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
32+
restore-keys: |
33+
${{ runner.os }}-maven-
34+
35+
- name: Build and analyze with SonarCloud
36+
env:
37+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # 在GitHub仓库Secrets中设置的SonarCloud Token
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub自动提供的Token,用于上传PR检查结果
39+
run: |
40+
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=MetaOpen -Dsonar.organization=acanx -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN

os-dependencies/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,12 @@
388388
</dependency>
389389

390390

391+
<dependency>
392+
<groupId>com.sun.mail</groupId>
393+
<artifactId>javax.mail</artifactId>
394+
<version>1.6.2</version>
395+
<scope>compile</scope>
396+
</dependency>
391397
<dependency>
392398
<groupId>org.apache.commons</groupId>
393399
<artifactId>commons-lang3</artifactId>

0 commit comments

Comments
 (0)