question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage of `silencer:globalFilters` in Maven projects.

See original GitHub issue

How can we use silencer:globalFilters in maven projects?

-P:silencer:globalFilters=<semicolon separated message regexes>

I am trying to pass the silencer flag option using scala-maven-plugin

<configuration>
<args>
<arg>-P:silencer:globalFilters=Unused import</arg>
<arg> ....<arg>
<arg>-Xfatal-warnings</arg>
<arg>-Ywarn-unused-import</arg>
</args>
</configuration>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
vamsiktcommented, Sep 30, 2019

Yes, that solves that issue. Thank you @jozic @SethTisue. Perhaps it is better to add these instructions to the README.

1reaction
joziccommented, Sep 30, 2019

this worked for me (Scala 2.12.10, silencer 1.4.4)

<plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>3.4.6</version>
                    <configuration>
                        <scalaCompatVersion>${scala.binary.version}</scalaCompatVersion>
                        <scalaVersion>${scala.version}</scalaVersion>
                        <failOnMultipleScalaVersions>true</failOnMultipleScalaVersions>
                        <args>
                            <arg>-Xlint</arg>
                            <arg>-deprecation</arg>
                            <arg>-unchecked</arg>
                            <arg>-feature</arg>
                            <arg>-language:postfixOps</arg>
                            <arg>-language:implicitConversions</arg>
                            <arg>-language:higherKinds</arg>
                            <arg>-Xfatal-warnings</arg>
                            <arg>-Ywarn-unused</arg>
                            <arg>-Ywarn-unused-import</arg>
                            <arg>-Ywarn-inaccessible</arg>
                            <arg>-Ywarn-dead-code</arg>
                            <arg>-Ypartial-unification</arg>
                            <arg>-P:silencer:globalFilters=Unused import</arg>
                        </args>
                        <jvmArgs>
                            <jvmArg>-Xmx4g</jvmArg>
                        </jvmArgs>
                        <compilerPlugins>
                            <compilerPlugin>
                                <groupId>com.github.ghik</groupId>
                                <artifactId>silencer-plugin_${scala.version}</artifactId>
                                <version>${silencer.plugin.version}</version>
                            </compilerPlugin>
                        </compilerPlugins>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.scala-lang</groupId>
                            <artifactId>scala-library</artifactId>
                            <version>${scala.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>scala-compile-first</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>add-source</goal>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>scala-test-compile</id>
                            <phase>process-test-resources</phase>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

though I failed to find a way to specify some particular imported class to be ignored

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven in 5 Minutes
Maven is a Java tool, so you must have Java installed in order to proceed. ... The pom.xml file is the core of...
Read more >
Introduction to the POM - Apache Maven
It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains...
Read more >
Maven Getting Started Guide
We are going to jump headlong into creating your first Maven project! To create our first Maven project we are going to use...
Read more >
Guide to Configuring Plug-ins - Apache Maven
Maven plugins (build and reporting) are configured by specifying a <configuration> element where the child elements of the <configuration> ...
Read more >
Usage - Apache Maven WAR Plugin
There are 4 ways to use the WAR Plugin: using the package phase with the project package type as war; invocation of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found