Jenkins:类路径包含多个SLF4J绑定

时间:2013-08-16 13:04:38

标签: jenkins log4j jira slf4j jira-plugin

我正在尝试在jenkins中运行JIRA插件的集成测试。我收到以下警告:

Running xxx
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/prj/xxx/atlassian/repository/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/prj/xxx/atlassian/repository/org/slf4j/slf4j-simple/1.6.4/slf4j-simple-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

知道如何禁用此功能吗?

我已经读过:http://www.slf4j.org/codes.html#multiple_bindings

但这对我没有多大帮助。

我需要设置什么样的依赖或排除(以及pom.xml中的位置)来摆脱此警告。

的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx</groupId>
<artifactId>xxx</artifactId>
<version>1.0</version>

<organization>
    <name>xxx</name>
    <url>xxx</url>
</organization>

<name>ClearQuestIdTrimmer</name>
<description>This plugin trims the ClearQuestIds.</description>
<packaging>atlassian-plugin</packaging>

<dependencies>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-api</artifactId>
        <version>${jira.version}</version>
        <scope>provided</scope>
    </dependency>
    <!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->
    <!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->

    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-core</artifactId>
        <version>${jira.version}</version>
        <scope>provided</scope>
    </dependency>
        <groupId>net.sourceforge.jexcelapi</groupId>
        <artifactId>jxl</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <!-- WIRED TEST RUNNER DEPENDENCIES -->
    <dependency>
        <groupId>com.atlassian.plugins</groupId>
        <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
        <version>${plugin.testrunner.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>jsr311-api</artifactId>
        <version>1.1.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.2-atlassian-1</version>
    </dependency>
    <!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
    <!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-tests</artifactId>
        <version>${jira.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-func-tests</artifactId>
        <version>${jira.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-jira-plugin</artifactId>
            <version>${amps.version}</version>
            <extensions>true</extensions>
            <configuration>
                <productDataPath>${project.basedir}/src/test/resources/generated-test-resources.zip</productDataPath>
                <productVersion>${jira.version}</productVersion>
                <productDataVersion>${jira.version}</productDataVersion>
                <testGroups>
                    <testGroup>
                        <id>wired-integration</id>
                        <productIds>
                            <productId>jira</productId>
                        </productIds>
                        <includes>
                            <include>it/**/*WiredTest.java</include>
                        </includes>
                    </testGroup>
                    <testGroup>
                        <id>traditional-integration</id>
                        <productIds>
                            <productId>jira</productId>
                        </productIds>
                        <includes>
                            <include>it/**/*TrdTest.java</include>
                        </includes>
                    </testGroup>
                </testGroups>
                <!-- Uncomment to install TestKit backdoor in JIRA. -->
                <!--
                <pluginArtifacts>
                    <pluginArtifact>
                        <groupId>com.atlassian.jira.tests</groupId>
                        <artifactId>jira-testkit-plugin</artifactId>
                        <version>${testkit.version}</version>
                    </pluginArtifact>
                </pluginArtifacts>
                -->
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<properties>
    <jira.version>6.1-20130626</jira.version>
    <amps.version>4.2.3</amps.version>
    <plugin.testrunner.version>1.1.1</plugin.testrunner.version>
    <!-- TestKit version 5.x for JIRA 5.x, 6.x for JIRA 6.x -->
    <testkit.version>6.0.25</testkit.version>

    <!-- Set encoding to UTF 8 - needed for Jenkins Integration Test -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- run integration tests in headless mode on CI -->
    <xvfb.enable>true</xvfb.enable>
</properties>

2 个答案:

答案 0 :(得分:1)

使用Maven Dependency插件跟踪传递依赖项的来源:

mvn dependency:tree -Dverbose -Dincludes=slf4j-simple

使用该输出,您应该能够在pom.xml中添加所需的排除项。

答案 1 :(得分:1)

我怀疑你在本地运行你的maven构建时没有问题吗?如果是这样,您可能会忽略此问题。如果你在本地遇到同样的问题,那么忽略后面的内容并使用依赖:tree:)

原因是Jenkins捆绑了多个slf4j绑定来解决致命问题。

提交日志是

  

捆绑slf4j绑定战争。请参阅war / pom.xml中的注释   详细讨论。这基本上是“该死的,如果我这样做,该死的   如果我不“情况,但鉴于JENKINS-12334是一个致命的错误,   捆绑绑定jar的缺点是“多重绑定”   警告,似乎较小的邪恶是捆绑它并冒一些风险   警告。

Issue | Commit | More information