1

我正在使用 Maven -assembly-plugin 并获得大量的 INFO 消息,其中列出了所有被省略的重复条目。有没有办法为这个单一的插件执行设置 log4j 级别为“WARN”?

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.3</version>
    <configuration>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <outputDirectory>${basedir}/../package/lib</outputDirectory>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>

    </executions>
</plugin>

例如,请注意此步骤的以下 log4j 输出示例中的重复项:

...
[INFO] META-INF/notice.txt already added, skipping
[INFO] META-INF/spring.handlers already added, skipping
[INFO] META-INF/spring.schemas already added, skipping
[INFO] META-INF/spring.tooling already added, skipping
[INFO] META-INF/INDEX.LIST already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] META-INF/license.txt already added, skipping
[INFO] META-INF/notice.txt already added, skipping
[INFO] overview.html already added, skipping
[INFO] META-INF/INDEX.LIST already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] META-INF/license.txt already added, skipping
[INFO] META-INF/notice.txt already added, skipping
[INFO] META-INF/spring.handlers already added, skipping
[INFO] META-INF/spring.schemas already added, skipping
[INFO] META-INF/spring.tooling already added, skipping 
...

就我而言,我有大约 3,000 条这些 [INFO] 消息。这会使 Maven 构建输出膨胀,并且更难看到真正的错误。

谢谢,

标记

4

2 回答 2

0

我不知道使用 log4j 的答案,但您可以使用下一版本的程序集插件来纠正您的问题

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4</version>
</plugin>
于 2013-07-27T15:28:36.863 回答
0

如果您使用的是 Maven 2.x,这似乎是不可能的,请参阅

您可以添加参数 '-q' 或 '--quiet' 使 Maven 只显示错误,但它是一个全局选项。

于 2013-01-04T04:11:31.517 回答