I am having a strange issue where uplading a .pom
file via the node-bintray package results in a 400.
All other file uploads are functioning correctly, and I can't find any documentation that might explain why a .pom
file should be different.
The pom file being uploaded is that which is generated by the com.github.dcendents.android-maven
gradle plugin.
Below is a code sample that reproduces the issue:
const repository = new Bintray({
username: bintrayProps.BINTRAY_USER,
apikey: bintrayProps.BINTRAY_API_KEY,
organization: bintrayProps.BINTRAY_ORG,
repository: bintrayProps.BINTRAY_MAVEN_REPO
});
repository.uploadPackage('packageName', '1.0.0', './myPomFile.xml', 'my/group/artifactId/1.0.0/artifactId-1.0.0-myPomFile.pom', false);
The error message is as follows:
Unable to upload files: Could not extract metadata for artifact \'my/group/artifactId/1.0.0/artifactId-1.0.0-myPomFile.pom\', content might be malformed.
Example pom file::
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>my.group</groupId>
<artifactId>artifactId</artifactId>
<version>1.0.0</version>
<packaging>aar</packaging>
<name>MyPackage</name>
<url>http://my-site.io</url>
</project>
Changing the remote path to have any other extension results in a successful upload.
EDIT
Changed the remote path to match the pom file to rule out that issue.
EDIT 2
I've narrowed down the issue to a specific file path... It seems to only reproduce when the remote path follows the structure seen above my/group/artifactId/version/artifactId-version-myPomFile.pom