Failed to Resolve Artifact - Missing javax.mail When Building the Distribution Source Code
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
The mail artifact was installed successfully in the local repository, however building the Confluence source code failed.
1
2
3
4
[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.
1
mvn install:install-file -DgroupId=javax.mail -DartifactId=mail -Dversion=1.3.3 -Dpackaging=jar -Dfile=mail.jar
Was this helpful?