diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index fe18a31e96ec..dd3c6a383634 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -141,6 +141,12 @@ runs:
echo "SPRING_JPA_SHOW_SQL=false" >> $GITHUB_ENV
echo "NG_CLI_ANALYTICS=ci" >> $GITHUB_ENV
+ JHI_PROJECT_VERSION=$JHI_VERSION
+ if [[ "true" != "{{ startsWith(github.ref, 'refs/tags/v') }}" ]]; then
+ JHI_PROJECT_VERSION="$JHI_VERSION-git"
+ fi
+ echo "JHI_PROJECT_VERSION=$JHI_PROJECT_VERSION" >> $GITHUB_ENV
+
if [[ "${{inputs.jhipster-bom-branch}}" != "release" && "${{inputs.jhipster-bom-branch}}" != "ignore" ]]; then
echo "JHI_BOM_VERSION=0.0.0-CICD" >> $GITHUB_ENV
fi
diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml
index cabbcbddf195..0dc93b04431b 100644
--- a/.github/workflows/angular.yml
+++ b/.github/workflows/angular.yml
@@ -226,16 +226,22 @@ jobs:
uses: jwalton/gh-docker-logs@v2
- name: 'ANALYSIS: Sonar analysis'
if: >-
+ github.event_name == 'push' &&
+ github.repository == 'jhipster/generator-jhipster' &&
+ matrix.sonar-analyse == 'true' &&
steps.compare.outputs.equals != 'true' &&
- matrix.sonar-analyse != 'false' &&
matrix.workspaces != 'true' &&
matrix.skip-frontend-tests != 1 &&
needs.build-matrix.outputs.client != 'false' &&
matrix.skip-backend-tests != 1 &&
needs.build-matrix.outputs.server != 'false'
- run: $JHI_SCRIPTS/25-sonar-analyze.sh
+ run: |
+ ./mvnw -ntp --batch-mode initialize org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar \
+ -Dsonar.host.url=https://sonarcloud.io \
+ -Dsonar.projectKey=jhipster-sample-application \
+ -Dsonar.organization=jhipster \
+ -Dsonar.login=$SONAR_TOKEN
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
check-angular:
permissions:
diff --git a/.github/workflows/devserver.yml b/.github/workflows/devserver.yml
index 420702202cf2..993909d6617d 100644
--- a/.github/workflows/devserver.yml
+++ b/.github/workflows/devserver.yml
@@ -148,12 +148,6 @@ jobs:
with:
name: screenshots-${{ matrix.app-sample }}
path: ${{ steps.setup.outputs.application-path }}/*/cypress/screenshots
- - name: 'ANALYSIS: Sonar analysis'
- if: steps.compare.outputs.equals != 'true' && matrix.sonar-analyse == 'true'
- run: $JHI_SCRIPTS/25-sonar-analyze.sh
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
check-dev-server:
permissions:
contents: none
diff --git a/.github/workflows/generator-database-changelog-liquibase.yml b/.github/workflows/generator-database-changelog-liquibase.yml
index 2009897a05f7..b911560f6996 100644
--- a/.github/workflows/generator-database-changelog-liquibase.yml
+++ b/.github/workflows/generator-database-changelog-liquibase.yml
@@ -145,8 +145,3 @@ jobs:
with:
name: screenshots-${{ matrix.app-type }}
path: ${{ steps.setup.outputs.application-path }}/*/cypress/screenshots
- - name: 'ANALYSIS: Sonar analysis'
- run: $JHI_SCRIPTS/25-sonar-analyze.sh
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
diff --git a/.github/workflows/react.yml b/.github/workflows/react.yml
index 8447c3583c1a..b5d7086a9c49 100644
--- a/.github/workflows/react.yml
+++ b/.github/workflows/react.yml
@@ -224,19 +224,6 @@ jobs:
- name: Dump docker logs
if: always()
uses: jwalton/gh-docker-logs@v2
- - name: 'ANALYSIS: Sonar analysis'
- if: >-
- steps.compare.outputs.equals != 'true' &&
- matrix.sonar-analyse != 'false' &&
- matrix.workspaces != 'true' &&
- matrix.skip-frontend-tests != 1 &&
- needs.build-matrix.outputs.client != 'false' &&
- matrix.skip-backend-tests != 1 &&
- needs.build-matrix.outputs.server != 'false'
- run: $JHI_SCRIPTS/25-sonar-analyze.sh
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
check-react:
permissions:
contents: none
diff --git a/.github/workflows/vue.yml b/.github/workflows/vue.yml
index 2aa3f35211ca..559dbc89b3de 100644
--- a/.github/workflows/vue.yml
+++ b/.github/workflows/vue.yml
@@ -224,19 +224,6 @@ jobs:
- name: Dump docker logs
if: always()
uses: jwalton/gh-docker-logs@v2
- - name: 'ANALYSIS: Sonar analysis'
- if: >-
- steps.compare.outputs.equals != 'true' &&
- matrix.sonar-analyse != 'false' &&
- matrix.workspaces != 'true' &&
- matrix.skip-frontend-tests != 1 &&
- needs.build-matrix.outputs.client != 'false' &&
- matrix.skip-backend-tests != 1 &&
- needs.build-matrix.outputs.server != 'false'
- run: $JHI_SCRIPTS/25-sonar-analyze.sh
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
check-vue:
permissions:
contents: none
diff --git a/generators/common/templates/sonar-project.properties.ejs b/generators/common/templates/sonar-project.properties.ejs
index cbd9226ce7bb..1b589b48ef12 100644
--- a/generators/common/templates/sonar-project.properties.ejs
+++ b/generators/common/templates/sonar-project.properties.ejs
@@ -1,6 +1,5 @@
sonar.projectKey=<%= baseName %>
sonar.projectName=<%= baseName %> generated by jhipster
-sonar.projectVersion=1.0
sonar.sources=<%= MAIN_DIR %>
sonar.host.url=http://localhost:9001
diff --git a/generators/generator-base.js b/generators/generator-base.js
index e778d5b2ae24..015c5e21d790 100644
--- a/generators/generator-base.js
+++ b/generators/generator-base.js
@@ -2917,6 +2917,7 @@ templates: ${JSON.stringify(existingTemplates, null, 2)}`;
loadAppConfig(config = _.defaults({}, this.jhipsterConfig, this.jhipsterDefaults), dest = this) {
dest.jhipsterVersion = config.jhipsterVersion;
dest.baseName = config.baseName;
+ dest.projectVersion = process.env.JHI_PROJECT_VERSION || '0.0.1-SNAPSHOT';
dest.applicationType = config.applicationType;
dest.reactive = config.reactive;
dest.jhiPrefix = config.jhiPrefix;
diff --git a/generators/server/templates/pom.xml.ejs b/generators/server/templates/pom.xml.ejs
index 796fb4df12b8..24dc5b5e33ab 100644
--- a/generators/server/templates/pom.xml.ejs
+++ b/generators/server/templates/pom.xml.ejs
@@ -25,7 +25,7 @@
<%= packageName %>
<%= dasherizedBaseName %>
- 0.0.1-SNAPSHOT
+ <%= projectVersion %>
jar
<%= humanizedBaseName %>
<%= projectDescription %>
diff --git a/test-integration/scripts/00-init-env.sh b/test-integration/scripts/00-init-env.sh
index 6a24df622b88..05d2125bb05f 100755
--- a/test-integration/scripts/00-init-env.sh
+++ b/test-integration/scripts/00-init-env.sh
@@ -96,3 +96,6 @@ JHI_NODE_VERSION=$(grep -o "NODE_VERSION = '[^']*'" $JHI_HOME/generators/generat
# npm version
JHI_NPM_VERSION=$(grep -o '"npm": "[^"]*"' $JHI_HOME/generators/common/templates/package.json | cut -f4 -d '"')
+
+# generator-jhipster version
+JHI_VERSION=$(grep -o '"version": "[^"]*"' $JHI_HOME/package.json | cut -f4 -d '"')
diff --git a/test-integration/workflow-samples/angular.json b/test-integration/workflow-samples/angular.json
index 8e73cf33c6a9..2421c1054a4d 100644
--- a/test-integration/workflow-samples/angular.json
+++ b/test-integration/workflow-samples/angular.json
@@ -3,14 +3,14 @@
{
"name": "ngx-default",
"app-sample": "ngx-default",
- "entity": "sqlfull"
+ "entity": "sqlfull",
+ "sonar-analyse": "true"
},
{
"name": "ngx-default-additional",
"entity": "none",
"app-sample": "ngx-default",
- "jdl-entity": "*",
- "sonar-analyse": "false"
+ "jdl-entity": "*"
},
{
"name": "ngx-mysql-es-noi18n-mapsid",