2013-01-02 82 views
1

我正在使用Maven -assembly-plugin並獲取大量的INFO消息,其中列出了所有將被省略的重複條目。有沒有辦法將log4j級別設置爲「WARN」來執行此單個插件?如何爲單個Maven插件執行設置log4j級別?

<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 
... 

在我的情況我有大約這些[INFO]消息3000。這擴大了Maven構建輸出,並且使得看到真正的錯誤變得更加困難。

感謝,

馬克

回答

0

如果你使用Maven 2.x,請參見this似乎是不可能的。

您可以添加參數'-q'或'--quiet'使Maven只顯示錯誤,但它是一個全局選項。

0

我不使用log4j的知道答案,但你可以使用裝配插件的下一版本糾正你的問題

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <version>2.4</version> 
</plugin> 
相關問題