Failed to Resolve Artifact - Missing javax.mail When Building the Distribution Source Code
Symptoms
The mail artifact was installed successfully in the local repository, however building the Confluence source code failed.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact. Missing: javax.mail:mail:jar:1.3.3
Cause
While running the command with -Dpackaging=jar -Dfile=javamail-1_3_3_01.zip
will execute. Maven would happily install (ie. copy across and rename) the file into your local repository and show a BUILD SUCCESSFUL message.
However, running the build script will give a Build Error. This is because Java dependencies are jars and the same goes with maven. There is no way for Java or maven to know what to look for in the zip file.
changing to -Dpackaging=zip will not work either.
When you try to run the build script - maven will be looking for a jar file, while the mail-1.3.3.jar (or whatever version) in your local repository actually contains more than just a jar file's content (they are actually the original zip files that are renamed, hence contain other files that come together with the zip files which cannot be understood by Maven and JVM).
Resolution
Unzip javamail-1_3_3_01.zip and use the extracted jar file for your local repository installation.
mvn install:install-file -DgroupId=javax.mail -DartifactId=mail -Dversion=1.3.3 -Dpackaging=jar -Dfile=mail.jar