JMeter gradle plugin causes build to fail with exception - gradle

I am trying to use the JMeter gradle plugin to run jmeter tests and produce a log on build.
Currently, I have added this to my build.gradle file:
apply plugin: 'jmeter'
buildscript{
repositories{
mavenCentral()
}
dependencies{
classpath "com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13"
}
}
jmeterRun.configure{
jmeterTestFiles = [file("src/test/jmeter/gradleTest.jmx")]
enableReports = true
}
However when I run the build.gradle file using 'jmeterRun' I get the following error:
org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-bin.zip'.
Here is the full error message
and it suggests I check the jmeter logs for more information, though no new logs are created and there is no entry in the existing log related to this error.
I had previously tried to use the plugin as suggested here, however I was getting an error saying the plugins block was not correct (despite being copy-pasted).
How do I get the JMeter plugin working properly?

Regardless of whether or not your test uses one one, a jmeter.properties file is required, otherwise an error will occur. Normally this error should say that
Could not read JMeter properties file
according to here.
I am still unsure why a jmeter.log file was created.

Related

Is there any way to get a "logical stacktrace" from Gradle?

I have a Gradle build that is failing because something is going wrong in one of the build steps. This particular step is not relevant to what I'm working on, and someone else is fixing it, but I'd rather not be held up waiting on them.
I've deleted the only reference to this step as a dependency of the core build in my build.gradle file... but it's still running! I tried running with the --stacktrace option, but all that gave me was a JVM stacktrace of Gradle's internal stack at the point where things failed, which is basically useless to me.
What I'd like is some actual useful information, a "stack trace" of the dependency chain that led to this step being included in the build process. Is there any way to get Gradle to give that to me?
I am guessing you want to see the dependency of tasks that will be executed.
In that case you could help yourself with using the following plugin https://gitlab.com/barfuin/gradle-taskinfo#gradle-taskinfo.
As such a graph is not provided out of the box from Gradle itself.
Include plugin
plugins {
id 'org.barfuin.gradle.taskinfo' version '1.0.5'
}
Then execute it to show task dependency tree (replacing task name with actual one)
./gradlew tiTree your_task_name

Error while setting up Allure Test Reporting in gradle project

I would like to setup Allure Test Report for the geb framework using gradle (https://gebish.org/), but get the error below although json files are created in the results folder.
added allure.properties with the following content in src/test/resources (inside the project folder):
allure.results.directory=build/allure-results
also added this to build.gradle, which points to the correct location:
systemProperty 'allure.results.directory', "$buildDir/allure-results"
https://gist.github.com/rnemeth1980/df0f7ed46487fca13e8d412c23984fbb
shows parts of build.gradle
get the following error message:
Cannot write to file '/home/abc/build/allure-results' specified for property '$1' as it is a directory.
more detailed error log https://gist.github.com/rnemeth1980/9c66bc96046086253c79275e88aef5d2
please help.
I had the same issue. Resolved it by install 'Gradle Extension' plugin into Intellij.

gradle build causing error :startScripts Failed

I am following the step-by-step instructions provided in http://spring.io/guides/gs/consuming-web-service/#scratch to learn how to consume a SOAP web service using Gradle and Spring-WS. I have created the folder structure specified in the above URL (namely., c:/src/main/java/hello) and copied the source code for build.gradle, WeatherClient.java, WeatherConfiguration.java and Application.java into this directory structure. When I execute the command "gradle build" in c:\src\main\java\hello, I am getting the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':startScripts'.
No value has been specified for property 'mainClassName'.
Following a suggestion I found in one of the Q&A in stackoverflow, I included mainClassName = '' at the end of the build.gradle file. The above error was overcome, but I do not find the "gs-consuming-web-service.jar" file in the C:\src\main\java\hello\build\libs folder as suggested by the instructions. Rather, I find a jar file named "hello.jar" in this folder.
And if I try to execute the hello.jar executable, I get a java.lang.ClassNotFoundException.
Has anyone tried to follow the instructions given in the URL: http://spring.io/guides/gs/consuming-web-service/#scratch with success? If yes, can you please advise where I have gone wrong?
I was able to get the demo project work by following the steps:
Create a folder named gs-consuming-web-service and in it, create a file named build.gradle with the source code provided in http://spring.io/guides/gs/consuming-web-service/#scratch. Add an extra dependency (the one that is highlighted below) in this build.gradle file at the location below:
dependencies {
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework.ws:spring-ws-core")
compile(files(genJaxb.classesDir).builtBy(genJaxb))
**compile("org.springframework:spring-web:4.1.4.RELEASE")**
jaxb "com.sun.xml.bind:jaxb-xjc:2.1.7"
}
Create the directory structure ...gs-consuming-web-service/src/main/java/hello and in the hello folder, create the java files for WeatherClient.java, WeatherConfiguration.java and Application.java using the source code in http://spring.io/guides/gs/consuming-web-service/#scratch.
Launch InteliJ IDE and select the import project option. In the ensuing screen/step, select the build.gradle file in gs-consuming-web-service folder. Select check-boxes "Use auto-import" and "Create directories for empty content roots automatically". In this screen, make sure that the Gradle home, Gradle JVM are pre-populated correctly (in my case, these have been pre-populated with the path to Gradle-2.8 and JDK 1.8 respectively). Click OK.
At command prompt window, while within the gs-consuming-web-service folder, execute the command "gradle build".
This should get you to a successful gradle build. Good luck and happy learning.

Gradle Plugin for SonarQube fails with error related to accessExternalSchema

For several of our projects, we get the following error, when using the Sonar Gradle plugin (http://docs.sonarqube.org/display/SONAR/Analyzing+with+Gradle).
11:26:16.744 ERROR - Error parsing XML: XML InputStream(5) schema_reference: Failed to read schema document 'persistence_1_0.xsd', because 'http' access is not allowed due to restriction set by the accessExternalSchema property.
We have run into this previously when running xjc tasks, and I tried to adapt the solution there, resulting in the following:
sonarqube {
System.setProperty('javax.xml.accessExternalSchema', 'all')
}
This however, didn't appear to have any effect.
Any suggestions on how to fix the problem?
Thanks!
You could maybe try to apply same workaround than How to surpass gradle wsimport task JDK 8 access restrictions?
Anyway in SonarQube 5.2 there will be no more database connection so no more persistence.xml.

set configuration properties in sonar

Maybe, this question is silly but I'm very new. I try to search without luck.
I got two errors when building maven project with sonar:
No information about coverage per test.
Although I had test code and these testing classes cover the code.
The global property 'sonar.doxygen.deploymentPath' is not set. Set it in SONAR and run another analysis.
I dont know it should be set where in sonar server. I set in web.xml or sonar-server.properties but it does not work.
Thanks.
About the first warning message this is not an error but a warning : since Sonar 3.5 this is possible to get the code coverage relating to each unit test. Here the message just says that this feature is not activated which is expected by default. Nevertheless I do agree that this warning message can be misleading.
About the second error message, I don't know the doxygen plugin but the message seems to be pretty clear : the sonar.doxygen.deploymentPath property has not be defined. See the plugin documentation : http://docs.codehaus.org/display/SONAR/Doxygen+Plugin.
Two things:
There is no war folder anymore since the sonarqube has given up tomcat support
The doxygen plugin is not implemented to upload the files in to the sonarqube server &/ installation, which means it only can be done by referencing the path inside your installation, e.g.:
run "mvn install sonar:sonar" in your project "/root/test.example.sonar.com"
in sonarqube set the cfg-key "sonar.doxygen.deploymentPath" the value: "/root/sonarqube-4.1.1/web/" and the cfg-key "sonar.doxygen.deploymentUrl" the value: "http://:9000"
have fun with your doxygen
Remember that the plugin will only be run through your mvn cmd, refreshing the page only will not do the job, you will have to analyse again after each cfg set :/
Check the file system and folder permission

Resources