aws / aws/aws-lambda-builders

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

Open
#176 0 comments 0 reactions 0 assignees View on GitHub
maintainer/need-response type/feature
Dominant language
Python
Stars
380
Forks
161
Avg merge
1d 1h
Merged PRs (30d)
2

Description

**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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.