Not able to exclude logging from nflow-tests.
jacksierkstra opened this issue · 2 comments
I have included nflow-tests in my application's pom.xml like so:
<dependencies>
...
<dependency>
<groupId>io.nflow</groupId>
<artifactId>nflow-tests</artifactId>
<version>${nflow.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Upon starting my test application, it always gives this warning:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/jacks/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/jacks/.m2/repository/io/nflow/nflow-tests/7.2.4/nflow-tests-7.2.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
09:51:45,715 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:51:45,717 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
I am not interested in the logback.xml that is added by nflow-tests, so I would like to exclude it. The normal way of doing that, is by excluding that dependency. But that doesn't help. I tried to exclude a lot of possible combinations like so:
<dependency>
<groupId>io.nflow</groupId>
<artifactId>nflow-tests</artifactId>
<version>${nflow.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-parent</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>slf4j</groupId>
<artifactId>slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
</exclusion>
</exclusions>
</dependency>
But none seems to get rid of the warning.
nflow-tests.jar
that is uploaded to Maven repository is an uberjar, that contains all classes of it's dependencies, packaged as a single jar. The dependencies cannot be excluded from it by Maven. Furthermore, nflow-tests.jar
is not intended to be included in your application classpath. Why do you need it? If there is something generally useful, we could extract that to a different module. Meanwhile, you can build nFlow locally and use the "unshaded" jar from nflow-tests/target/original-nflow-tests-<version>-SNAPSHOT.jar
, if really needed.
To be completely honest with you: I made a mistake. For some reason I thought I needed nflow-tests
to be able to run workflow tests and that is not true (thanks for pointing that out). Besides that, I just wanted to get rid of the error messages and have complete control over what is in- and excluded. Sorry for wasting your time. I am closing this issue.