maven2: excluding directory from WAR

Both of your solutions wouldn’t help, as they would add an additional resource that is then deactivated. The webapp source folder is copied by default, without the resource mechanism. The mechanism to deactivate a part of that is through the <warSourceExcludes> parameter, like this: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1</version> <configuration> <warSourceExcludes>webscripts/**</warSourceExcludes> </configuration> </plugin>

Maven: downloading files from url

If the file is a Maven dependency, you could use the Maven Dependency Plugin which has a get goal. For any file, you could use the Antrun plugin to call Ant’s Get task. Another option would be the maven-download-plugin, it has been precisely created to facilitate this kind of things. It’s not very actively developed … Read more

Is it possible to override the configuration of a plugin already defined for a profile in a parent POM?

Overriding configurations from a parent pom can be done by adding the combine.self=”override” attribute to the element in your pom. Try changing your plugin configuration to: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <executions> <execution> <id>my-testCompile</id> <phase>test-compile</phase> <goals> <goal>testCompile</goal> </goals> <configuration combine.self=”override”> <fork>true</fork> <executable>${jdk15.executable}</executable> <compilerVersion>1.5</compilerVersion> <source>1.5</source> <target>1.5</target> <verbose>true</verbose> </configuration> </execution> </executions> </plugin> For more information on overriding plugins, see: … Read more

What is the difference between “mvn deploy” to a local repo and “mvn install”?

Ken, good question. I should be more explicit in the The Definitive Guide about the difference. “install” and “deploy” serve two different purposes in a build. “install” refers to the process of installing an artifact in your local repository. “deploy” refers to the process of deploying an artifact to a remote repository. Example: When I … Read more

Is there a way to tell surefire to skip tests in a certain package?

Let me extend Sean’s answer. This is what you set in pom.xml: <properties> <exclude.tests>nothing-to-exclude</exclude.tests> </properties> <profiles> <profile> <id>fast</id> <properties> <exclude.tests>**/*Dao*.java</exclude.tests> </properties> </profile> </profiles> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <excludes> <exclude>${exclude.tests}</exclude> </excludes> </configuration> </plugin> Then in CI you start them like this: mvn -Pfast test That’s it.

How can I view transitive dependencies of a Maven pom.xml file?

On the CLI, use mvn dependency:tree (Here are some additional Usage notes) When running dependency:tree on multi-module maven project, use mvn compile dependency:tree instead1. Otherwise, the POM Editor in M2Eclipse (Maven integration for Eclipse) is very good, and it includes a hierarchical dependency view. 1If you don’t compile, you might get error Failed to execute … Read more