aws / aws/aws-lambda-builders

SAM is not compatible with license-maven-plugin-git

Aperta
#176 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
maintainer/need-response type/feature
Lingua principale
Python
Stelle
380
Fork
161
Merge medio
1g 1h
PR unite (30g)
2

Descrizione

**Description:**

In my company, we have to use [license-maven-plugin-git](https://mvnrepository.com/artifact/com.mycila/license-maven-plugin-git) to check for a company header in all files (it's a company mandate).

Since java workflow is excluding `.git` ([here](https://github.com/awslabs/aws-lambda-builders/blob/develop/aws_lambda_builders/workflows/java_maven/workflow.py#L22)) when copying it to scratch dir, `sam build` is failing, because it fails to check for files header.

```shell
[INFO] --- license-maven-plugin:3.0:check (default) @ my-lambdas ---
[INFO] Checking licenses...
[WARNING] failure occured while calling class com.mycila.maven.plugin.license.git.CopyrightRangeProvider
java.lang.RuntimeException: Could not compute the year of the last git commit for file mylambda.java
at com.mycila.maven.plugin.license.git.CopyrightRang[WARNING] failure occured while calling class com.mycila.maven.plugin.license.git.CopyrightRangeProvider
```

I think we can have at least two approaches to fix:

1. Be able to override `EXCLUDED_FILES` value to allow `.git` on java workflow
2. Be able to append custom maven parameters, then I can do `-Dlicense.skip=true` and use another build command to validate license header.

I do prefer option 1, since I may have only one build command.

**Steps to reproduce the issue:**
1. Configure a java project with [license-maven-plugin-git](https://mvnrepository.com/artifact/com.mycila/license-maven-plugin-git)
2. Try to build it using `sam build`

**Observed result:**
`sam build` is failing since `license-maven-plugin-git` is unable to get git year.

**Expected result:**
`Be able to build a project using `license-maven-plugin-git` by using only `sam build`

**Additional environment details (Ex: Windows, Mac, Amazon Linux etc)**
- java8
- maven 3.6.2

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da aws_lambda_builders/workflows/java_maven/workflow.py, in particolare dall’impostazione EXCLUDED_FILES citata nell’issue. Riproduci il problema con un progetto Java che utilizza license-maven-plugin-git e sam build, quindi determina quale delle configurazioni proposte consente di completare la build. Il lavoro è completato quando il progetto viene compilato con sam build mentre il plugin può accedere ai metadati Git necessari.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, python
Ambito
build-system
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.