2

我正在尝试为 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>

4

2 回答 2

1

使用Maven 依赖插件来追踪传递依赖的来源:

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

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

于 2013-08-16T13:17:06.240 回答
1

我怀疑您在本地运行 Maven 构建时没有问题?如果是这样,您可能可以忽略此问题。如果您在本地确实有同样的问题,请忽略以下内容并使用依赖项:树 :)

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

提交日志是

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

问题| 提交| 更多信息

于 2013-08-16T14:36:33.940 回答