Maven

A build tool for Java plus a package manager

The short version:

Similarities with Ant

Superficial differences between Maven and Ant:

The big difference: imperative vs. declarative.

Ant’s build.xml is imperative.

Maven’s pom.xml is declarative.

The biggest advantage of the declarative style is when you have dependencies. If you know you depend on something, say junit or apache-commons or batik-svggen, you just grab the bit of code that “declares” the dependency, and it will automatically go get the .jar file for you, and put it in the right place in your classpath for compiling, creating javadoc, testing, making a jar, etc.

The biggest drawback is that if/when you are trying to do something very specific like put a file in a specific directory (e.g. putting your javadoc under docs, because that’s where github-pages expects them to be), you may find yourself fighting with Maven a bit. Maven wants to put things where it wants to put them, and expects you as the developer to just submit to its will.

References:

Remove custom files (e.g. logs) in mvn clean

   <!-- also remove logs on maven clean -->
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <filesets>
            <fileset>
              <directory>logs</directory>
              <includes>
                <include>**/*.log</include>
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>

Related topics: