Skip to content

Commit

Permalink
docs for using with maven (#270)
Browse files Browse the repository at this point in the history
* docs for using with maven

* Fix typo
  • Loading branch information
bbarker authored and ClaireNeveu committed Oct 19, 2016
1 parent 25b6602 commit 8357e54
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions OTHER-WAYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,36 @@ To use your custom `WartTraverser`, you'll need to provide a classpath where it
scalacOptions += "-P:wartremover:cp:someUrl"
```

## Apache Maven

You can use WartRemover in Maven by employing it as a compilerPlugin to scala-maven-plugin:

```xml
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<compilerPlugins>
<compilerPlugin>
<groupId>org.wartremover</groupId>
<artifactId>wartremover_2.11</artifactId>
<version>1.1.1</version>
</compilerPlugin>
</compilerPlugins>
<args>
<arg>-P:wartremover:only-warn-traverser:org.wartremover.warts.Unsafe</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
```

See the notes on the compiler plugin above for options to pass as `<arg>`s.

## Macros

You can make any wart into a macro, like so:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ wartremoverClasspaths += "some-url"
wartremoverErrors += Wart.custom("org.your.custom.WartTraverser")
```

See also [other ways of using WartRemover](/OTHER-WAYS.md) for information on how to use it as a command-line tool, a macro or a compiler plugin, while providing all the `scalac` options manually.
See also [other ways of using WartRemover](/OTHER-WAYS.md) for information on how to use it as a command-line tool, in Maven builds, and as a macro or a compiler plugin, while providing all the `scalac` options manually.

* Note - the WartRemover SBT plugin sets scalac options - make sure you're not overwriting those by having a `scalacOptions := ...` setting in your SBT settings. Use `scalacOptions ++= ...` instead.

Expand Down

0 comments on commit 8357e54

Please sign in to comment.