Execute a task in gradle just before Test Executor ends - gradle

I want to run a ant target which will dump the jacoco coverage data from localhost:6300 (Jacoco is setup as javaagent with options: output=tcpserver,address=*,port=6300). The ant target is a client which will be called after running the tests to dump coverage data to a file. I used the following:
test.finalizedBy(antjacocoReport)
antjacocoReport is the ant target which is executing fine, but since the Gradle Test Executor exits before this task, it is showing
[ant:jacoco:dump] Connecting to localhost/127.0.0.1:6300
[ant:jacoco:dump] Connection refused: connect
and
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':antjacocoReport'.
> Unable to dump coverage data
Anyone has any idea how to accomplish this task before gradle exhaust's the jacoco agent. ?

Related

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.

Failed to capture snapshot of input files for task

I am newbee to Groovy, Gradle, IntelliJ IDEA, Gradle Plugin Development.
Whenever I click on the publishToMavenLocal, I am getting the following error,
Task :compileGroovy FAILED
FAILURE: Build failed with an exception.
What went wrong: Failed to capture snapshot of input files for task ':compileGroovy' property 'classpath' during up-to-date check. >
Failed to create MD5 hash for file content. Deprecated Gradle features
were used in this build, making it incompatible with Gradle 5.0. BUILD
FAILED in 11s 2 actionable tasks: 2 executed Data error (cyclic
redundancy check)
Can anyone help me resolve this ? This is a pure Gradle plugin developed using Groovy.

ActiveJDBC and Cobertura instrumentation

We want to use ActiveJDBC for database access. So far, everything works as expected after some minor hurdles with ActiveJDBC instrumentation in our IDEs.
However, we use Maven to build our projects and use Cobertura for reporting about code coverage in the Maven site build. It seems that ActiveJDBC instrumentation and Cobertura's code coverage instrumentation do not play together.
When building our Maven site, we get the following error during Cobertura's code coverage analysis:
Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default-site) on project settings-core:
failed to get report for org.codehaus.mojo:cobertura-maven-plugin: Failed to execute goal org.javalite:activejdbc-instrumentation:1.4.11:instrument (classes) on project settings-core:
Failed to add output directory to classpath:
org.javalite.instrumentation.InstrumentationException: java.lang.RuntimeException: <..>.Setting class is frozen -> [Help 1]
Is there any way to get those two to play together?
Cobertura uses bytecode instrumentation and so does ActiveJDBC, which can cause a conflict. In our experience, JaCoCo achieves the same goal and does not conflict with instrumentation: http://eclemma.org/jacoco/trunk/index.html

local sonar analysis using a remote sonar server

I am doing a sonar analysis from my machine using a sonar instance on a remote server.
Local machine: Window7, apache-maven-3.2.5
Remote sonarcube server: sonarcube Version 3.7.3
I am using below command from command prompt:
mvn sonar:sonar -Dsonar.jdbc.url=<jdbcurl> -Dsonar.host.url=<sonarserver url>
I have defined a sonar profile for running the same
Whe I run the said mvn command, then I am getting below error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project builder-allmodules: Can not execute SonarQube analysis: Can not execute Findbugs: java.lang.RuntimeException: edu.umd.cs.findbugs.NoClassesFoundToAnalyzeException: No classes found to analyze in mymavenproject\target\classes *xyz.jar *F:\m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar *abc.jar *lmn.jar aaa.jarbbb.jar *ggg.jar
mymavenproject\target\classes: doesn't have any classes, instead, there is bundled jar at mymavenproject\target\ which contains all the classes
Also, another issue is that it is trying to analyze all the dependent jars also which should not be the case as I need sonar analysis for my project only
Can you let me know what I might be missing?
Because you've included FindBugs rules in your analysis profile, you're required to provide unbundled classes to the analysis.

Sonar runner Exception

While running sonarunner in gradle I am getting below exception:
Execution failed for task ':sonarRunner'.
Fail to request server version
I am running below command from command line:
gradle clean build sonarRunner -
Dsonar.host.url=http://srvsentdev01.lhs-systems.com:9000/
-Dsonar.jdbc.url=jdbc:mysql://srvsentdev01.lhs-systems.com/sonarqube -Dsonar.jdbc.driverClassName=com.mysql.jdbc.Driver -Dsonar.jdbc.username=xxxxx -Dsonar.jdbc.password=xxxxxxxx
where I am going wrong?

Resources