How can I stop a gradle build from within an artifact transform?
Any exceptions I throw are completely swallowed by gradle and the build continues on as normal until it hits a FileNotFoundException as I haven't provided an output jar.
None of the solutions provided in this question work.
I would like to provide some additional information in my error messages, rather than the build fail for an unknown reason
Related
I am using a Maven repo inside a Gradle build that relies on BasicAuthentication to access its contents. If the credentials are incorrect or missing then the build fails indirectly, due to missing artefacts. However, I would much prefer it if the build could fail immediately in this case, e.g. by throwing an exception. I'm new to Gradle but despite searching the Gradle documentation I can't seem to find such a facility. I am using Gradle v7.1.1 inside Android Studio. Is this possible?
I am encountering a rather annoying situation where intermittently the surefire reports are not getting generated for some projects. There are no errors in the log -
[INFO] --- maven-surefire-plugin:2.19:test (default-test) # nut-jar ---
[JENKINS] Recording test results
Perhaps related, the jar produced by the build does not contain any classes.
Later in the build, SonarQube gets invoked and because the jar does not have any classes, I get the "XXX is not accessible through the ClassLoader" warning. Because there is no bytecode, any issues for the missing classes are being marked as fixed. On a subsequent build, where the jar produced has the actual classes, all the "fixed" issues get redetected and new issues are opened. This is causing havoc with tracking existing versus new issues.
Ultimately I need to find out why the class files are not being packaged into the jar. But for now, I am hoping someone has an idea how I can abort SonarQube if it detects that bytecode is not present.
Since you're using Jenkins, I'd move analysis into a Conditional Build Step, and condition it on the existence of one of your .class files.
I want to investigate what kind of actions(instructions) + configurations are composing a specific gradle task(intention is to reverse-engineer it and rewrite it).
In my case this is the task that I want to do reverse-engineering on(from an android build):
:app:transformResourcesWithMergeJavaResForRelease
Which will help furthermore to investigate this issue:
How do I resolve "Duplicate files copied in APK META-INF/*"
Sometimes my Maven build gives a warning, i.e., the Maven output has a line starting with [WARNING]. (I am not talking about, e.g., warnings in compiled Java code, but, e.g., a warning that an empty jar-file is being created.)
In such a situation I want my build to fail. How do I do that?
This feature was already suggested to Maven team in MNG-5091. Upvote it in their JIRA and let's wait (this is what I did) :)
How to give the order of compile of clojure files from "clojure-maven-plugin"?
I thought it should automatically get the order and if there is some cyclic dependency it throws cyclic-dependency exception.
My issue is when I cloning the project from git it build successful sometimes and sometimes it fails. When I going through the logs I saw that two different classes were selected to compile first in each project by that plugin.
In the failure one throws null-pointer exception which there is some .class file is not there because that class should be created before the current one.
The order in the reactor of Maven will automatically be ordered into correct order but if there is a cyclic dependency than neither Maven nor any other build is able to handle that.