When using scm:bootstrap, with goals to do after checkout:
mvn -Dgoals=compile scm:bootstrap
maven apparently spawns another process that will execute mvn command for that goal. To set up the environment for the child process, it runs external command (in case of Linux it is "env"), and tries to parse it, assuming that every line of the output has "KEY=VALUE" format. However, when the environment has shell functions in it, this logic fails.
I see two ways of fixing this.
1. Just fix the parsing logic.
Pros: this will be compatible with everything it is compatible today.
Cons: parsing logic will be essentially more complex, because you need to figure out multiline functions definitions.
2. Use System.getEnv() to get the environment, make array of strings containing "KEY=VALUE" expressions, and use it for the child process.
Pros: very clean and simple solution. I actually tested it, took 10 minutes to do.
Cons: System.getEnv() became available as of JDK 1.5. Seems like all Maven2 is supposed to be compatible with JDK 1.4, this might be a problem.