4
votes

I would like to use Mavens dependency:build-classpath to create a class path:

$ mvn dependency:build-classpath -Dmdep.prefix='lib' -f xpath.pom
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xpath 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:build-classpath (default-cli) @ xpath ---
[INFO] Dependencies classpath:
lib/serializer-2.7.1.jar:lib/xalan-2.7.1.jar:lib/xml-apis-1.3.04.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.251s
[INFO] Finished at: Tue Feb 26 16:37:01 CET 2013
[INFO] Final Memory: 5M/109M
[INFO] ------------------------------------------------------------------------

How can I stop Mavens INFO spam without suppressing the intended output of build-classpath?

I found answers, which explain that I have to use the -q option to suppress INFO output. But using this option results in no output at all.

I know I can use grep, but I would like to avoid it. And I can not believe that Maven can not do this out of the box, because it makes the dependency plugin quite useless.

This is the complete pom:

<?xml version="1.0"?>
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>nobody</groupId>
  <artifactId>xpath</artifactId>
  <version>1</version>

  <dependencies>
    <dependency>
      <groupId>xalan</groupId>
      <artifactId>xalan</artifactId>
      <version>2.7.1</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.basedir}/lib</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
3

3 Answers

4
votes

I know this is not ideal for some, but you can use outputFile to have it put the output into a file.

0
votes

INFO is the very minimal amount of information you really need to be seeing about the build. This is the default logging level it's using. If you tell it not to use INFO, then all the log messages in Maven and the plugins you're using will simply not output anything.

0
votes

In linux you can add a grep -v INFO to the end of your statement

$ mvn help:evaluate -Dexpression=project.parent.version |grep -v INFO 4.0.6-a $