22
votes

For weeks, I've been wrestling with maven, getting it to deploy our project "properly."

I'm almost done but I have one stubborn little problem:

When I use the maven assembly plugin with the "directory" goal as in

mvn assembly:directory

I get LOTS of console output like the following:

[INFO] tomcat/conf already added, skipping
 [INFO] tomcat/conf/Catalina already added, skipping
 [INFO] tomcat/conf/Catalina/localhost already added, skipping
 [INFO] tomcat/webapps already added, skipping

I've written my own assembly descriptor that basically copies several FileSets into various sub-directories within our deploy directory. Messages like the ones above appear whenever a file from one FileSet is being copied to a location in which another FileSet has already created the basic directory structure (and some "default" files that can be overwritten).

So, I'm having a hard time figuring out:

How do I either 1) Suppress these messages (but only the "already added" messages) or 2) allow for overwrite?

6

6 Answers

12
votes

The info messages are coming from the Plexus Archiver. There is an open bug report on this issue:

http://jira.codehaus.org/browse/PLXCOMP-129

10
votes

The Plexus bug mentioned by vocaro has been fixed. Using the maven-assembly-plugin with version 2.4 (highest at time of writing) does not print the verbose messages.

3
votes
  1. Upgrade to Maven 3.1.x or higher - see http://maven.apache.org/maven-logging.html

    The standard Maven distribution, from Maven 3.1.0 onward, uses the SLF4J API for logging combined with the SLF4J Simple implementation.

  2. Now with simplelogger we have fine-grained control over log messages. To identify which logger is causing the unwanted messages, edit MAVEN_HOME/conf/logging/simplelogger.properties and change the following:

    org.slf4j.simpleLogger.showLogName=true

  3. Observe the unwanted garbage in your build output:

    [INFO] org.codehaus.plexus.archiver.jar.JarArchiver - META-INF/MANIFEST.MF already added, skipping
    
  4. Back in simplelogger.properties, reduce logging level for the offending logger(s) by class name (also set showLogName back to false)

    org.slf4j.simpleLogger.log.org.codehaus.plexus.archiver.jar.JarArchiver=warn

2
votes

It is probably better to use maven-resources-plugin with copy-resources goal to pull together the directories you need into one place. Create an execution for your basic directory structure and add subsequent executions for the customized parts. Setting the overwrite property of the goal to true will ensure that the custom files will overwrite the defaults.

Then in your assembly descriptors use the fileset you've just made.

1
votes

if i understand your question correct you should use the maven-dependency plugin to copy files/overwrite instead of using the assembly plugin...

1
votes

maven 3.0.4:

I still get these messages when making a single jar or combined sources for distribution. http://jira.codehaus.org/browse/PLXCOMP-129 seems to be not in maven.

My workaround is to use various exclude patterns, and in particular, %regex[..] for folders. I don't know how stable or general this is, and clearly it needs to be maintained. However, we are in the situation where we get so many messages we can't see when a real message appears we need to do something about.

Skipping the NOTICE, LICENSE -- I put the correct merged text versions in later in the assembly. The partial ones from the dependencies aren't good enough anyway.

Matching the folder name excludes everything, not the folder itself. Folders do appear in the output, and no INFO level "skipping" messages.

<unpackOptions>
  <excludes>
    <exclude>**/NOTICE*</exclude>
    <exclude>**/LICENSE*</exclude>
    <exclude>**/DEPENDENCIES*</exclude>
    <exclude>META-INF/**</exclude>
    <!-- Exclude folders - this removes "skipping" messages -->
    <exclude>%regex[.*/]</exclude>
  </excludes>
</unpackOptions>