Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move standard maven site (d3e554c) into the combined documentation site. #228

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [Properties and placeholders](#properties-and-placeholders)
- [Supported comment types](#supported-comment-types)
- [Changing header style definitions](#changing-header-style-definitions)
- [Dependency enforcement](#dependency-enforcement)
- [Development](#development)
- [Requirements](#requirements)
- [Releasing a version](#releasing-a-version)
Expand All @@ -32,7 +33,7 @@ Basically, when you are developing a project either in open source or in a compa
* Remove existing header (`remove` goal).
* Custom mappings: enables easy support of new file extensions.
* Variable replacement: you can add some variable in your header, such as ${year} or ${owner} and they will be replaced by the corresponding values taken from the pom or system properties.
* [Dependency enforcement](license-maven-plugin/src/site/markdown/dependency-enforcement.md): optionally fail the build if the dependencies do not meet your license policies
* Dependency enforcement: optionally fail the build if the dependencies do not meet your license policies

## Links

Expand Down Expand Up @@ -65,6 +66,7 @@ Basically, when you are developing a project either in open source or in a compa
* [@rhuss](/~https://github.com/rhuss)
* [@rmannibucau](/~https://github.com/rmannibucau)
* [@rnc](/~https://github.com/rnc)
* [@rremer](/~https://github.com/rremer)
* [@sebhoss](/~https://github.com/sebhoss)
* [@shane-hp](/~https://github.com/shane-hp)
* [@stain](/~https://github.com/stain)
Expand Down Expand Up @@ -633,6 +635,71 @@ And it should generate headers like:
#endregion
```

### Dependency enforcement

This plugin can be configured to break the build when its dependencies do not adhere to a configured license policy. This plugin relies on the accuracy of the `<licenses>` maven property configured in the pom of artifacts your project declares in `<dependencies>`.

There are currently three types of policies which can be enforced:

1. LICENSE_URL - strict match on the URL element of a License
2. LICENSE_NAME - strict match on the name of a License
3. ARTIFACT_PATTERN - regex on a groupdId:artifactId

Rules can be defined in the plugin configuration like so:

```xml
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<dependencyEnforce>true</dependencyEnforce>
<dependencyExceptionMessage>A custom error message for how to handle approvals in your organization</dependencyExceptionMessage>
<dependencyPolicies>
<dependencyPolicy>
<type>LICENSE_NAME</type>
<rule>APPROVE</rule>
<value>Public Domain</value>
</dependencyPolicy>
<dependencyPolicy>
<type>LICENSE_URL</type>
<rule>APPROVE</rule>
<value>https://www.apache.org/licenses/LICENSE-2.0.txt</value>
</dependencyPolicy>
<dependencyPolicy>
<type>ARTIFACT_PATTERN</type>
<rule>APPROVE</rule>
<value>com.mycila.*</value>
</dependencyPolicy>
<dependencyPolicy>
<type>ARTIFACT_PATTERN</type>
<rule>DENY</rule>
<value>com.example.*</value>
</dependencyPolicy>
<dependencyPolicy>
<type>ARTIFACT_PATTERN</type>
<rule>ALLOW</rule>
<value>com.example.subpackage:other-artifact:jar:1.0.0</value>
</dependencyPolicy>
</dependencyPolicies>
</configuration>
</plugin>
```

There is also an implicit default deny artifact pattern policy, so if you enable dependency enforcement and have any dependencies, you must configure a policy. The ordering of the declared dependencyPolicies does not matter, and in aggregate they will be enforced in the following way:

1. defaultPolicy included in the plugin, matching all artifacts with a deny rule
2. APPROVE policies
3. DENY policies

Given the above configuration example, you could state:

* the allow rule for com.example.subpackage:other-artifact:jar:1.0.0 will never do anything, because there is a deny rule for com.example.*
* all com.mycila artifacts will be allowed, regardless of their license
* any other artifact with a license name of 'Public Domain' will be allowed
* any other artifact with a license URL of explicitely 'https://www.apache.org/licenses/LICENSE-2.0.txt' will be allowed
* all other artifacts will fail the build with the following message header: "A custom error message for how to handle approvals in your organization" along with the list of artifacts which violated the policies


## Development

### Requirements
Expand Down
63 changes: 0 additions & 63 deletions license-maven-plugin/src/site/markdown/dependency-enforcement.md

This file was deleted.

28 changes: 0 additions & 28 deletions license-maven-plugin/src/site/site.xml

This file was deleted.