Gradle publishing error to maven; uploadArchives - gradle

I want to publish my library github to maven central, trying to push it with gradle uploadArchives
I always get the same error, i've almost search everywhere but there is no clear explanation to host your library in maven central.
Error is;
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':library:androidJavadocs'.
Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): 'C:\DynamicLayout-master\DynamicLayout-master\library\build\tmp\androidJavadocs\javadoc.options'
the log of terminal is here: http://pastebin.com/gKU2Kkpt
this is the lib that i try to publish it; https://github.com/Swisyn/DynamicLayout/tree/master

Related

Unable to load Maven meta-data from private repo. Received 403: Forbidden

I'm trying append a private dependency into my project (react-native-android) via Maven. Unfortunately I'm get following error message when I try to build ./gradlew assembleDebug my project.
Error message returned as below:
> FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve com.facebook.react:react-native:0.19.+.
Required by:
project :app > project :react-native-i18n
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml.
> Could not get resource 'https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml'.
> Could not GET 'https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml'. Received status code 403 from server: Forbidden
Code example
repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://xxxPRIVATE_REPOxxx/android" }
}
dependencies {
implementation project(':react-native-i18n')
implementation 'com.android.support:support-v4:+'
implementation 'xxxPRIVATE_DEPENDENCYxxx:1.0.+'
}
I have read numerous post and research on maven and gradle's topic. Here's my finding towards my issues:
Meaning that my sequence of declaring maven by right will get the "correct/suitable" module from the first declared maven instead of the following (maven xxxPRIVATE_REPOxxx)
The order of declaration determines how Gradle will check for dependencies at runtime. If Gradle finds a module descriptor in a particular repository, it will attempt to download all of the artifacts for that module from the same repository. You can learn more about the inner workings of dependency downloads.
Returning of 403 Forbidden does not necessary mean I do not have access to the repo I'm trying to access, but also missing of resource.
Hence I made an assumption here... During the download of project dependencies, Maven loop through both maven repo (maven google & xxxPRIVATE_REPOxxx) to get the suitable lib. However when it reaches xxxPRIVATE_REPOxxx, it failed to locate maven-metadata.xml therefore result with https://xxxPRIVATE_REPOxxx/android/com/facebook/react/react-native/maven-metadata.xml and 403 Forbidden.
My question:
Should there be a way to indicate which dependency to get from which Maven?
I was imaging something like this
implementation 'xxxPRIVATE_DEPENDENCYxxx:1.0.+' : xxxPRIVATE_REPOxxx (You know what I mean)
I have tried:
Upgrading my Android-Plugin to 3.5.0
Upgrading my Gradle version to 5.6.4
./gradlew clean and re-build after steps 1 and 2
Turns out the issue was because the react native dependencies use by 3rd party library (react-native-i18n) was too low. You can find it at react-native-i18n's build.gradle.
dependencies {
compile 'com.facebook.react:react-native:0.12.+'
}
Hence my fix to this was update the code to
compile 'com.facebook.react:react-native:+'

Failed to publish publication 'mavenJava' to repository 'maven'

I am trying to upload a library to mavencentral for the first time. I get to build and run some tasks from maven-publish gradle plugin. But, On publish task, I get below error.
* What went wrong:
Execution failed for task ':publishMavenJavaPublicationToMavenRepository'.
> Failed to publish publication 'mavenJava' to repository 'maven'
> Could not write to resource 'https://oss.sonatype.org/service/local/staging/deploy/maven2/dev/spiti/utilities/data-reader/1.0.0/data-reader-1.0.0.jar'.
> Read timed out
Also, I tried the solution from here Gradle build configured signatory to complete :signArchives. Cmd ./gradlew assemble -x signArchives runs successfully but issue seem to persist.
Can someone guide me thru how to overcome this.

Gradle Plugin Test Project Build Failing

I downloaded the gradle plugin test project from their github here:
https://github.com/gradle/gradle/tree/master/subprojects/docs/src/samples/customPlugin
I also updated gradle to latest (4.7).
When I gradle build the consumer project, I get the following build error:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'consumer'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find org.gradle:customPlugin:1.0-SNAPSHOT.
Searched in the following locations:
file:/C:/Code/gradle/subprojects/docs/src/samples/customPlugin/repo/org/gradle/customPlugin/1.0-SNAPSHOT/maven-
metadata.xml
file:/C:/Code/gradle/subprojects/docs/src/samples/customPlugin/repo/org/gradle/customPlugin/1.0-SNAPSHOT/custom
Plugin-1.0-SNAPSHOT.pom
file:/C:/Code/gradle/subprojects/docs/src/samples/customPlugin/repo/org/gradle/customPlugin/1.0-SNAPSHOT/custom
Plugin-1.0-SNAPSHOT.jar
Required by:
project :
What's the issue here? I guess I don't understand gradle plugins enough. Does the plugin need to be built somehow? I have no 1.0-SNAPSHOT pat or anything of the sort, which seems to be where its looking.
Does the plugin need to be built somehow ?
Yes, at first, otherwise the consumer project won't find it.
Inside the plugin project, just run gradle uploadArchive
And then retry a gradle build inside the consumer project

Properties file path was not found! (Relevant only for builds running on a CI Server)

I get the following message from gradle when I run a 'gradle build' with Artifactory configured.
[buildinfo] Properties file path was not found! (Relevant only for builds running on a CI Server)
It starts appearing when I include the following line in my build.gradle:
apply plugin: 'com.jfrog.artifactory'
I would like to know what it exactly means and what to do about it, but I cannot find anything anywhere about it.
Gradle integration with Artifactory can be achieved by using the Gradle Artifactory Plugin or alternatively from a CI server (Jenkims, Bamboo or TeamCity), by using the relevant Artifactory Plugin for the CI server.
All Artifactory Plugins for the CI servers share the same code with the Gradle Artifactory Plugin to integrate with Artifactory.
The warning message you're getting is relevant only in case the build is running on a CI server. If it is not, this message is not an indication of a problem and it should be ignored. To avoid confusion, in the next release this message type will be changed to info instead of warning.
As for the actual meaning of this message, here's a short description:
The Artifactory Plugins for CI servers use a property file to pass
information to the build tool process (Gradle for example). The Gradle
Artifactory Plugin code (running as part of the Gradle process) uses
the data of in the file for artifact resolution and deployment from/to
Artifactory, as well as deployment for the build information to
Artifactory.
Using the Gradle Artifactory Plugin directly from your build script does not use or require this properties file and that's why you're seeing this message.

Download latest release from Artifactory with Gradle

Artifactory has a feature of their API where you can download the latest release of a jar file (See http://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveLatestArtifact).
Their example is:
GET http://localhost:8080/artifactory/ivy-local/org/acme/[RELEASE]/acme-[RELEASE].jar
I'm working on a project where all builds get published and I want to grab the jar from the last one. So what I'm looking for is a dependency like this in gradle:
compile "org.acme:acme:1.0.0.9.[RELEASE]"
This fails due to escaping of the square brackets so I tried:
compile "org.acme:acme:1.0.0.9.%5BRELEASE%5D"
This seems to allow gradle/ivy to find the file but it fails because the .pom file version does not match what is defined.
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':project:compile'.
> Could not resolve org.acme:acme:1.0.0.9.%5BRELEASE%5D.
Required by:
org.acme:acme:unspecified
> Could not resolve org.acme:acme:1.0.0.9.%5BRELEASE%5D.
> inconsistent module metadata found. Descriptor: CachedResource: /Users/xxxx/.gradle/caches/artifacts-26/filestore/org.acme/acme/1.0.0.9.%5BRELEASE%5D/pom/3986d9c1a27873ce92c0dbd089fc1ca9618f8c1a/acme-1.0.0.9.%5BRELEASE%5D.pom for http://localhost/artifactory/org/acme/acme/1.0.0.9.%5BRELEASE%5D/acme-1.0.0.9.%5BRELEASE%5D.pom Errors: bad version: expected='1.0.0.9.%5BRELEASE%5D' found='1.0.0.9.80'
Is there any way to get gradle and ivy to pull the latest release from artifactory?
I was able to get this working using the ivy syntax:
compile "org.acme:acme:1.0.0.9.+"
This solves the problem I have but I never did manage to get it working using the Artifactory [RELEASE] url.

Resources