Gradle Publish Plugin fails with "Execution failed for task ':signArchives'." - gradle

I release my org's gradle plugin go the gradle repository using the Gradle Publish Plugin Repo. https://plugins.gradle.org/.
I created an account, created an API Key/Secret combo, and configured these properties in our gradle.properties file. I then call a ./gradlew publishPlugins
This was working fine until sometime between January and May where we tried to release again. We now get the ``Execution failed for task ':signArchives'.``` Error. we have never needed to configure a signatory, but for some reason it's throwing this error now.
We've tried configuring the gradle.properties file in both our GRADLE_HOME and in the root project directory. We have also tried passing our properties as command line properties as such: $ ./gradlew publishPlugins -Pgradle.publish.key=<key> -Pgradle.publish.secret=<secret>. Our attempts have been to no avail.

Related

Unable to deploy to cloudhub mule4 application with Gradle

I am trying to build my mule application and deploy it to cloudhub with Gradle (The Gradle version I'm using is: Gradle 4.10.2) . For this I have added the build.gradle file in my project as shown below:
When I give the Gradle build command it is successful as shown below:
But when I execute Gradle deploy (gradle deploy --info) command, it fails with following error:
Any help to resolve the above issue would be appreciated.
That Gradle has been abandoned for some years and seems to be trying to use a CloudHub REST API endpoint that is no longer valid. If you want to use Gradle you will need a newer Gradle plugin that uses the current CloudHub API. Note that MulesSoft only supports Maven.
You can try running with --stacktrace as the error message suggests to find out more details about the error.

How do I force Gradle to get the most recent snapshot version of my package?

I have a Maven package I've hosted on GitHub package registry.
Whenever I make an update to the package I run mvn deploy to publish the changes, but if I simply run gradle install on the dependent application it doesn't seem to install the latest version of the package
(not sure if settings.xml is relevant to this question so I removed it, but it can be seen at the link to my previous question).
I had a similar issue with using the latest snapshot version of the package in another dependent, which was using Maven as the package manager/build tool instead of Gradle. That was resolved by checking a box to "always update snapshots" in Maven settings. I have checked the box in this project as well, but it doesn't seem to resolve the issue now.
What I have tried:
Invalidating cache and restarting IntelliJ
reimporting all gradle projects
deleting the dependency from my build.gradle and then reimporting projects and install, followed by adding it back and reimporting all projects and install
running ./gradlew build -x test --refresh-dependencies (test disabled because they were failing)
This is the log after I run gradle install:
4:07:08 PM: Executing task 'install'...
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :jar SKIPPED
> Task :install
BUILD SUCCESSFUL in 2s
3 actionable tasks: 1 executed, 2 up-to-date
4:07:10 PM: Task execution finished 'install'.
In my build.gradle I use the following syntax for my dependency (under dependencies):
compile('com.companyname:packagename:0.0.3-SNAPSHOT')
and this is what I have under repositories:
maven {
url "https://maven.pkg.github.com/companyname/packagename"
credentials {
username "TaylorBurke"
password "*****************"
}
}
Not sure if it is related, but when I go into my Maven settings to try and update the repository I get this error:
So there it is, I think I've included everything. Is it a configuration issue with Maven, Gradle, or IntelliJ?
Edit: because it has been suggested to close this question I am pointing out that the link to the other question does not address installing with Gradle, it simply addresses an error after running mvn deploy. I have already deployed the new package successfully and can get the new version from my other application. My problem is specific to gradle install. Even though the accepted answer mentions he had a similar problem using Gradle (but my problem is not with deploying either) he goes on to say that snapshot versions would provide a solution to the problem expressed, and I am already using a snapshot version in this package. That question is clearly quite different and not at all related to mine.
You have tried quite a few things with IntelliJ, but the problem happens when you run the build from the command line (./gradlew build). That should be a good indication that the problem is not with IntelliJ.
By default, Gradle will cache changing dependencies (e.g. SNAPHOST dependencies) for 24 hours. During that time, it will not ask the repository for newer versions. So if you publish a new version under the same name, Gradle might not see it for another day.
Using the --refresh-dependencies option will make Gradle ignore the cache, and thereby download the artifacts again.
You can also change the cache retention period through a ResolutionStrategy. You can also configure it to always check for changed dependencies if you like.
Read more about dynamic dependencies here: https://docs.gradle.org/current/userguide/dynamic_versions.html
If you are curious, the Gradle artifact cache is by default located in $USER_HOME/.gradle/caches/modules-2/files-2.1 (the numbers may be different depending on which version of Gradle you are using). This cache is unrelated to the one you mention in IntelliJ.
Also, the authentication error in the IntelliJ maven repository browser is because your credentials are in the Gradle configuration and not in IntelliJ. So this is also unrelated to Gradle.

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

How to have Buildship recognize existing projects in Eclipse Mars

I just converted my Maven project to a gradle project. It was a multi project structure:
master-project
pom.xml
---->project1
-------->pom.xml
---->project2
-------->pom.xml
---->project3
-------->pom.xml
I ran a gradle init on it and have this structure now:
master-project
build.gradle
---->project1
-------->build.gradle
---->project2
-------->build.gradle
---->project3
-------->build.gradle
Everything builds fine, and I have been able to get some things done with that I couldn't figure out how to do with Maven, so that's great. Next step was to integrate that into the IDE since the Maven Dependencies are gone since I have removed the pom.xml files.
However the project isn't recognized as a gradle project - and I am not sure how to change that?
In Eclipse Mars it's still recognized as a Maven build, not gradle....
Thanks in advance.
EDIT: I reimported the projects which enabled the plugin for Eclipse. Now I am having weird behavior.
The build works from the command line, however when attempting the same execution from within Eclipse, it fails trying to copy the file dependencies.
For example:
Couldn't copy dependency jakarta-regexp-1.4.jar
java.nio.file.NoSuchFileException: C:\Users\user.m2\repository\jakarta-regexp\jakarta-regexp\1.4\jakarta-regexp-1.4.jar -> build\jfx\app\lib\jakarta-regexp-1.4.jar
I haven't changed the repo from maven yet - just changed the build scripts. This is running from the master project. So I am confused as to why the script would work from the commandline but not from within eclipse.
EDIT 2: Turns out this behavior is also present when running from the command line when the --daemon flag is set. Is there anyway to run the tasks without the daemon in Buildship? Or perhaps a way to fix this issue when the --daemon flag is enabled?
Thanks.
The issue with the build was that there is a leak in the JDK when bundling the JRE with the native app. This only happens when running with the --daemon flag (which all IDEs user). Therefore until this is fixed you will need to run gradle --stop and then run the clean.
The plug in I am using is no longer running the native task when running with --daemon.

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.

Resources