24

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
gMale
  • 17,147
  • 17
  • 91
  • 116

6 Answers6

12

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

vocaro
  • 2,779
  • 2
  • 23
  • 16
10

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.

Attila
  • 28,265
  • 3
  • 46
  • 55
3
  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

Steve Jones
  • 1,528
  • 19
  • 12
2

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.

pharsfalvi
  • 787
  • 1
  • 8
  • 12
1

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>
AndyS
  • 16,345
  • 17
  • 21
1

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

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • Thanks for you response. The maven-dependency-plugin does not seem to be a good fit for my needs. In fact, I tried it a few weeks ago and, after digging in, I found that it's more geared toward copying artifacts (such as JUnit) than file sets. It seems the assembly:directory goal is the better choice for moving (assembling) sets of files into an output directory. From what I gather, the assembly plugin is for when you want to group things together in one place, typically for zipping. Right now, my only problem is I can't figure out how to suppress/avoid the "already added" messages. – gMale Apr 09 '10 at 19:10
  • Hm..the maven-dependency-plugin (http://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html) seemed to be exactly what you need (it has overwrite options etc.)..copy artifacts (files) to a particular location...May be it would be a good idea to take a look at the maven-cargo-plugin (http://cargo.codehaus.org/Maven2+plugin), cause it can start/stop/deploy to tomcat etc. BTW: Which version of the assembly-plugin do you use? May be update to newest.. – khmarbaise Apr 14 '10 at 13:43
  • This doesn't exactly solve my problem but I will accept your answer since I have no others. It's the thought that counts, right? lol – gMale Jul 02 '10 at 17:36
  • 1
    @gmale dont accept answers if they dont answer your question. I came in hopes to solve my problem. I am left disappointed :( – Mahdi Yusuf Sep 23 '10 at 15:30
  • @garbagecollector: sorry for your inconvenience. But the question went unanswered for 3 months. No one else even made an attempt. I feel it's only fair to give the guy credit for trying. After all, the answer "I accept" and "the correct answer" aren't necessarily the same thing. As a counter example, someone might correctly answer my question in an offensive way. It would be "the correct answer" but it wouldn't be the one I'd accept. – gMale Sep 23 '10 at 15:45
  • @gmale I disagree completely. a question is asked, the correct answer is the one that helped the user the most in solving the problem. If no one has looked at it for 3 months, put a bounty on it. – Mahdi Yusuf Sep 23 '10 at 18:50
  • 1
    @gmale Why not upvote it but don't accept it until a correct answer *is* posted (like vocaro's for example)? – Lyle Feb 03 '11 at 22:29
  • @Lyle: I would agree with you and dusty if, when I hovered over the check mark, it said "correct answer." However, it says "accepted answer," which I define as the answer I accept. That is a subjective decision--to each, his own. "Accept" != "Correct". Since acceptances aren't permanent, I think it further illustrates my point. If someone provides a better answer, then I'll change what I accept. Until then, if there's only one contestant, there is only one winner. – gMale Feb 09 '11 at 22:40