Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
docs: move user document from README to maven site
Browse files Browse the repository at this point in the history
  • Loading branch information
KengoTODA committed Feb 22, 2019
1 parent ed6226e commit db3650c
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 62 deletions.
33 changes: 1 addition & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,7 @@ Designed to use in incremental build, like pre-merge build and local build.

## How to use

### Introduce incremental-analysis plugin to your Maven project

Add the following `<plugin>` element into your `pom.xml`:

```xml
<plugin>
<groupId>com.worksap.tools</groupId>
<artifactId>incremental-analysis-maven-plugin</artifactId>
<version>1.0.1</version>
</plugin>
```

Make sure it runs before the [spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin/).

### Run incremental analysis in local

By default, this plugin runs to detect changes between your `HEAD` and `refs/heads/master`.
This fits [the GitHub Flow](https://githubflow.github.io/) and [the GitLab Flow](https://docs.gitlab.com/ee/workflow/gitlab_flow.html).

If you want to full analysis in local, use `<skip>` configuration then Maven run full analysis by default.
You may overwrite this configuration by profile activated in the CI build.

```xml
<plugin>
<groupId>com.worksap.tools</groupId>
<artifactId>incremental-analysis-maven-plugin</artifactId>
<version>1.0.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
```
Refer [this plugin's project documentation](https://worksapplications.github.io/incremental-analysis/plugin-info.html) for detail.

## Known problems

Expand Down
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-markdown</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -251,6 +258,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<configuration>
<requirements>
<maven>${maven.version}</maven>
<jdk>1.8</jdk>
</requirements>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,11 @@

/**
* A mojo to generate {@code -onlyAnalyze} parameter for spotbugs-maven-plugin. Generated parameter
* will be set as property of current Maven execution.
* will be set as property of current Maven execution.<br>
*
* <p>Execute this mojo before you run spotbugs-maven-plugin, then you can check analysis only for
* Execute this mojo before you run spotbugs-maven-plugin, then you can check analysis only for
* updated Java classes.
*
* <pre>
* &lt;plugin&gt;
* &lt;groupId&gt;com.worksap.tools&lt;/groupId&gt;
* &lt;artifactId&gt;incremental-analysis-maven-plugin&lt;/artifactId&gt;
* &lt;version&gt;1.0.1&lt;/version&gt;
* &lt;executions&gt;
* &lt;execution&gt;
* &lt;phase&gt;verify&lt;/phase&gt;
* &lt;goals&gt;
* &lt;goal&gt;spotbugs&lt;/goal&gt;
* &lt;/goals&gt;
* &lt;/execution&gt;
* &lt;/executions&gt;
* &lt;/plugin&gt;
* &lt;plugin&gt;
* &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
* &lt;artifactId&gt;spotbugs-maven-plugin&lt;/artifactId&gt;
* &lt;executions&gt;
* &lt;execution&gt;
* &lt;phase&gt;verify&lt;/phase&gt;
* &lt;goals&gt;
* &lt;goal&gt;spotbugs&lt;/goal&gt;
* &lt;/goals&gt;
* &lt;/execution&gt;
* &lt;/executions&gt;
* &lt;/plugin&gt;</pre>
*
* @author Kengo TODA ([email protected])
*/
@Mojo(
Expand All @@ -79,21 +52,36 @@
public class SpotBugsMojo extends AbstractMojo {
private final GitUpdatedJavaCodeDetector detector;

@Parameter(property = "project", required = true)
@Parameter(property = "project")
private MavenProject project;

/**
* Name of the property to generate value by this plugin, to specify {@code -onlyAnalyze} option to SpotBugs.
*/
@Parameter(defaultValue = "spotbugs.onlyAnalyze")
private String propertyToAnalyze;

/**
* Name of the property to generate value by this plugin, to decide that spotbugs-maven-plugin needs to skip analysis or not.
*/
@Parameter(defaultValue = "spotbugs.skip")
private String propertyToSkip;

/**
* Git ref of the source of pull-request or merge-request.
*/
@Parameter(defaultValue = Constants.HEAD, property = "incremental.spotbugs.source")
private String source;

/**
* Git ref of the target of pull-request or merge-request.
*/
@Parameter(defaultValue = "refs/heads/master", property = "incremental.spotbugs.target")
private String target;

/**
* Flag to skip execution of this incremental-analysis plugin.
*/
@Parameter(defaultValue = "false", property = "incremental.spotbugs.skip")
private boolean skip;

Expand Down
17 changes: 17 additions & 0 deletions src/site/markdown/examples/local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Run incremental analysis in local

By default, this plugin runs to detect changes between your `HEAD` and `refs/heads/master`.
This fits [the GitHub Flow](https://githubflow.github.io/) and [the GitLab Flow](https://docs.gitlab.com/ee/workflow/gitlab_flow.html).

If you want to full analysis in local, use `<skip>` configuration then Maven run full analysis by default.
You may overwrite this configuration by profile activated in the CI build.

```xml
<plugin>
<groupId>com.worksap.tools</groupId>
<artifactId>incremental-analysis-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
```
6 changes: 6 additions & 0 deletions src/site/markdown/examples/maven.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Run incremental analysis in your Maven project

Refer [the plugin documentation](/plugin-info.html) and modify your `pom.xml` accordingly.

Make sure this plugin is described before the [spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin/).
Then spotbugs-maven-plugin can use updated property and run incremental analysis.
4 changes: 4 additions & 0 deletions src/site/markdown/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Incremental Analysis Maven Plugin

This Maven Plugin helps developers to run static analysis only for updated codes.
Designed to use in incremental build, like pre-merge build and local build.
4 changes: 4 additions & 0 deletions src/site/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ limitations under the License.
<item name="Introduction" href="index.html"/>
<item name="Goals" href="plugin-info.html"/>
</menu>
<menu name="Examples">
<item name="Run incremental analysis in your Maven project" href="examples/maven.html"/>
<item name="Run incremental analysis in local" href="examples/local.html"/>
</menu>
<menu ref="reports"/>
</body>
<custom>
Expand Down

0 comments on commit db3650c

Please sign in to comment.