Skip to content

Commit e40ac7a

Browse files
committed
feat: added maven-install
1 parent 1d44055 commit e40ac7a

6 files changed

Lines changed: 25 additions & 8 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
- id: prevent-commit-on-default
1+
- id: git-prevent-commit-on-default
22
name: Prevent a commit on the default branch
33
description: |
44
Prevent a commit on the default branch
55
A Pull Request should be used
6-
entry: git-hooks/prevent-commit-on-default
6+
entry: git-hooks/git-prevent-commit-on-default
77
language: script
88
pass_filenames: false
99
always_run: true
1010
stages: [ pre-commit ]
1111
minimum_pre_commit_version: 3.2.0
12-
- id: prevent-out-of-sync-commit
12+
- id: git-prevent-out-of-sync-commit
1313
name: Prevent a commit on a out-of-sync branch
1414
description: |
1515
Prevent a commit on a out-of-sync branch
1616
A pull should be done first
17-
entry: git-hooks/prevent-out-of-sync-commit
17+
entry: git-hooks/git-prevent-out-of-sync-commit
1818
language: script
1919
pass_filenames: false
2020
always_run: true
@@ -29,12 +29,21 @@
2929
pass_filenames: false
3030
always_run: true
3131
stages: [ pre-commit ]
32-
- id: check-pom-xml
32+
- id: maven-check-pom-xml
3333
name: check maven pom
3434
description: |
3535
Check a maven pom file
36-
entry: git-hooks/check-pom-xml
36+
entry: git-hooks/maven-check-pom-xml
3737
language: script
3838
pass_filenames: false
3939
files: 'pom\.xml'
4040
stages: [ pre-commit ]
41+
- id: maven-install
42+
name: Install artifacts in the local repo
43+
description: |
44+
Install artifacts in the local repo by running maven install
45+
entry: git-hooks/maven-install
46+
language: script
47+
pass_filenames: false # only once
48+
files: \.java$ # only when a java file is present
49+
stages: [ post-commit ]

copier-template/.pre-commit-config.yaml.jinja2

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ repos:
3838
- repo: https://github.com/combostrap/devfiles
3939
rev: "{{ _external_data.project_version }}"
4040
hooks:
41-
- id: prevent-out-of-sync-commit
41+
- id: git-prevent-out-of-sync-commit
4242
name: prevent out-of-sync branch commit
4343
{%- if package_manager == 'maven' %}
44-
- id: check-pom-xml
44+
- id: maven-check-pom-xml
4545
name: check pom.xml file
46+
- id: maven-install
47+
name: install artifacts in local repo
4648
{%- endif %}
4749
- repo: https://github.com/editorconfig-checker/editorconfig-checker
4850
rev: c9d5ed0 # v3.4.1

git-hooks/maven-install

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
# A hook to install the artifacts locally
3+
set -TCEeuo pipefail
4+
5+
# Add the artifacts to the local repo
6+
./mvnw -Dmaven.test.skip=true install

0 commit comments

Comments
 (0)