The story behind: I submitted a bug to some public repo in GitHub, and it was fixed, but when I asked to release these changes I didn't get any response. So I'm waiting for next library version for 2 months. So I decided to fork this repo and publish to custom Bintray. The repo is https://github.com/okta/okta-sdk-java
The project has multiple maven modules:
$ find . -type f -name pom.xml
./httpclients/okhttp/pom.xml
./httpclients/httpclient/pom.xml
./impl/pom.xml
./swagger-templates/pom.xml
./pom.xml
./integration-tests/pom.xml
./api/pom.xml
./coverage/pom.xml
./examples/pom.xml
./examples/quickstart/pom.xml
I need to publish only impl
module.
The problem is that root pom.xml
has parent configuration:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.okta</groupId>
<artifactId>okta-parent</artifactId>
<version>14</version>
<relativePath>../okta-java-parent</relativePath>
</parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>1.6.0-SNAPSHOT</version>
<packaging>pom</packaging>
And all deploy config is specified in okta-parent
pom.
I tried to override repository config with (in root pom.xml
):
<distributionManagement>
<repository>
<id>bintray-g4s8-maven</id>
<name>mvn</name>
<url>https://api.bintray.com/maven/g4s8/mvn/okta-sdk-impl/;publish=1</url>
</repository>
</distributionManagement>
but it didn't help.
I have server configuration in my settings.xml
for this repo, and it's working fine for all other projects of mine:
<settings
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>bintray-g4s8-maven</id>
<username>g4s8</username>
<password>...</password>
</server>
</servers>
</settings>
When I'm trying to publish it I'm getting error:
$ mvn deploy -pl impl -Ppublish -DskipTests
...
[INFO] --- nexus-staging-maven-plugin:1.6.8:deploy (injected-nexus-deploy) @ okta-sdk-impl ---
[INFO] Performing deferred deploys (gathering into "/home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred")...
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/target/okta-sdk-impl-1.6.0-SNAPSHOT.jar to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT.jar
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/pom.xml to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT.pom
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/target/okta-sdk-impl-1.6.0-SNAPSHOT-sources.jar to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT-sources.jar
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/target/okta-sdk-impl-1.6.0-SNAPSHOT-javadoc.jar to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT-javadoc.jar
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/target/okta-sdk-impl-1.6.0-SNAPSHOT-javadoc.jar to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT-javadoc.jar
[INFO] Deploying remotely...
[INFO] Bulk deploying locally gathered artifacts from directory:
[INFO] * Bulk deploying locally gathered snapshot artifacts
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/maven-metadata.xml
Downloaded from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/maven-metadata.xml (993 B at 412 B/s)
Uploading to sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-20191101.130725-30-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 58.070 s
[INFO] Finished at: 2019-11-01T16:07:41+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy (injected-nexus-deploy) on project okta-sdk-impl: Failed to deploy artifacts: Could not transfer artifact com.okta.sdk:okta-sdk-impl:jar:javadoc:1.6.0-20191101.130725-30 from/to sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots/): Failed to transfer file https://oss.sonatype.org/content/repositories/snapshots/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-20191101.130725-30-javadoc.jar with status code 401 -> [Help 1]
Maven is uploading artifacts to https://oss.sonatype.org/
instead of configured URL https://api.bintray.com/maven/g4s8/mvn/okta-sdk-impl/;publish=1
. How can I force it to use my URL instead of parent URL?
Update
Effective pom shows both repositories in distributionManagement
:
<distributionManagement>
<repository>
<id>bintray-g4s8-maven</id>
<name>mvn</name>
<url>https://api.bintray.com/maven/g4s8/mvn/okta-sdk-impl/;publish=1</url>
</repository>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
It is looking like you are building a SNAPSHOT version. The configured <snapshotRepository>
is oss.sonatype...
. You only added a configuration for building release versions.