Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Gradle 2.0 #30

Open
RoryStraubel opened this issue Jul 23, 2014 · 23 comments
Open

Support Gradle 2.0 #30

RoryStraubel opened this issue Jul 23, 2014 · 23 comments

Comments

@RoryStraubel
Copy link

Gradle has recently upgraded to version 2.0 with some important updates. This makes the jmeter plugin impossible to install. Thanks.

@staleks
Copy link

staleks commented Dec 18, 2014

Same here.

I have installed Gradle 2.2.1 and after setting things up, I have following error:

Could not find method add() for arguments [jmeterEditor, class com.github.kulya.gradle.plugins.jmeter.JmeterRunGuiTask] on task set.

@foragerr
Copy link
Contributor

foragerr commented Apr 5, 2015

Are you guys talking about the bundled gradle wrapper version?

@staleks
Copy link

staleks commented Apr 6, 2015

No.

I have downloaded latest Gradle version 2.3.

This is the build script:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "com.github.kulya:jmeter-gradle-plugin:1.3.1-2.6"
    }
}

apply plugin: 'jmeter'

apply plugin: 'java'
apply plugin: 'eclipse'

sourceCompatibility = 1.8
version = '0.0.1-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    testCompile 'junit:junit:4.12'
}

jmeterRun.configure {
    jmeterTestFiles = [file("src/test/jmeter/test1.jmx")]
}

And here is the error:

A problem occurred evaluating root project 'gradle-jmeter'.
> Failed to apply plugin [id 'jmeter']
   > Could not find method add() for arguments [jmeterEditor, class com.github.kulya.gradle.plugins.jmeter.JmeterRunGuiTask] on task set.

I am not using task wrapper, just plain old gradle command from command line.

Any help would be appreciated.

NOTE: of course there is test1.jmx JMeter test in src/test/jmeter/ folder.

@foragerr
Copy link
Contributor

foragerr commented Apr 6, 2015

Can you please try with 1.3.2-2.6 as well?

@staleks
Copy link

staleks commented Apr 6, 2015

Hi, I will,

but that version I don't see as released version :)

Stay tuned. I will be back to you.

@foragerr
Copy link
Contributor

foragerr commented Apr 6, 2015

It is.
http://mvnrepository.com/artifact/com.github.kulya/jmeter-gradle-plugin

While you're at it, you should up your jmeter version as well :)

@staleks
Copy link

staleks commented Apr 6, 2015

Ok, now we are moving :)

I see that new version is uploaded to central M2 repo.

But this version is not in github:
https://github.com/kulya/jmeter-gradle-plugin/releases

Or maybe I am somewhere wrong?

Anyway, now I have different error when I run

$ gradle jmeterRun

Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file '/home/astoisavljevic/work-home/gradle-jmeter/workspace/gradle-jmeter/build.gradle'.
Included projects: [root project 'gradle-jmeter']
Evaluating root project 'gradle-jmeter' using build file '/home/astoisavljevic/work-home/gradle-jmeter/workspace/gradle-jmeter/build.gradle'.
All projects evaluated.
Selected primary task 'jmeterRun' from project :
Tasks to be executed: [task ':jmeterRun']
:jmeterRun (Thread[main,5,main]) started.
:jmeterRun
Executing task ':jmeterRun' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
jmeter home is set ot /home/astoisavljevic/work-home/gradle-jmeter/workspace/gradle-jmeter/build/jmeter
:jmeterRun FAILED
:jmeterRun (Thread[main,5,main]) completed. Took 0.447 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jmeterRun'.
> Something goes wrong when we execute jmeter test.... Please see jmeter logs for more information

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 4.558 secs
Stopped 0 compiler daemon(s).

Maybe you have some idea what is wrong here?

Thank You

@staleks
Copy link

staleks commented Apr 6, 2015

If I execute this task from Eclipse IDE,

here is the "Details log"

Something goes wrong when we execute jmeter test.... Please see jmeter logs for more information
Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-bin.zip'.

I am pretty sure that I don't have Gradle 2.2.1.

As I said previously, I am using Gradle 2.3

astoisavljevic@astoisavljevic-laptop:~/work-home/gradle-jmeter/workspace/gradle-jmeter$ gradle -v

------------------------------------------------------------
Gradle 2.3
------------------------------------------------------------

Build time:   2015-02-16 05:09:33 UTC
Build number: none
Revision:     586be72bf6e3df1ee7676d1f2a3afd9157341274

Groovy:       2.3.9
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.7.0_75 (Oracle Corporation 24.75-b04)
OS:           Linux 3.13.0-48-generic amd64

That might put some light on the problem :)

Thank You

@foragerr
Copy link
Contributor

foragerr commented Apr 6, 2015

Ah I see, the releases page needs to be updated.

Something goes wrong when we execute jmeter test.... Please see jmeter logs for more information

The problem isn't the plugin anymore, its jmeter :) This plugin runs jmeter as a separate process, jmeter logs aren't show in the build output. You should look at the jmeter log, I believe the default location is projectfolder/build/jmeter.

@staleks
Copy link

staleks commented Apr 6, 2015

You should look at the jmeter log, I believe the default location is projectfolder/build/jmeter.

Does it means that I need to have jmeter installed in
projectFolder/build/jmeter ?

@foragerr
Copy link
Contributor

foragerr commented Apr 6, 2015

No, the plugin creates the folder, and then adds a jmeter.log to it when you run gradle jmeterRun

@staleks
Copy link

staleks commented Apr 6, 2015

You are right,

there is folder projectFolder/build/jmeter created.

And plugin creates ext and junit folders in jmeter. And further more there are two properties files
saveservice.properties and upgrade.properties. But nothing more :(

I think that problem still is in this error log

Something goes wrong when we execute jmeter test.... Please see jmeter logs for more information
Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-bin.zip'.

@foragerr
Copy link
Contributor

foragerr commented Apr 6, 2015

Well, you're not getting the second line when running from commandline. Eclipse gradle plugin by default picks up the wrapper version from your project folder - not certain what version it uses if wrapper isn't present in the project.

I believe gradle version isn't your problem, unfortunately you're running into #40 during jmeter launch.
How do you feel about building the plugin from source?

@staleks
Copy link

staleks commented Apr 9, 2015

OK, sorry for delay, but I had some "burning" issues on my daytime project :)

Now, I've cloned repository, build from source and got following artifacts in ${PROJECT_HOME}/build/libs folder:

  • jmeter-gradle-plugin-1.3.3-2.13-SNAPSHOT.jar,
  • jmeter-gradle-plugin-1.3.3-2.13-SNAPSHOT-javadoc.jar and
  • jmeter-gradle-plugin-1.3.3-2.13-SNAPSHOT-sources.jar

Can you help me now how to integrate this version now in my project build script ?

Thank You

@staleks
Copy link

staleks commented Apr 9, 2015

Following "Maven logic" (as I am coming from this world and I am new to Gradle), I guess that
I need to have this JAR in ~/.m2/repository (then I can have mavenLocal() as repository for this plugin)

But building this project from source, doesn't generate pom.xml and I am afraid that just placing this JAR
"jmeter-gradle-plugin-1.3.3-2.13-SNAPSHOT.jar" in ~/.m2/repostiory/com/github/kulya/jmeter-gradle-plugin/1.3.3-2.13-SNAPSHOT without having proper pom.xml

won't work for me.

Any suggestions ?

Thank You

@foragerr
Copy link
Contributor

foragerr commented Apr 9, 2015

@staleks 1.3.3 and 1.3.4 binaries are now built and published to maven central - except it may take some time for them to appear there. Meanwhile you can use them from this maven repo: https://oss.sonatype.org/content/groups/public

1.3.3 has a different defect, you should use 1.3.4

If you still want to build from source, you can add apply plugin: 'maven' to your build.gradle file and then you would be able to run task gradle install to push jars and poms correctly to your local repo.

@staleks
Copy link

staleks commented Apr 10, 2015

Ok, this seems working :)

just for future users:

buildscript section:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13"
    }
}

and repostiories:

repositories {
    mavenCentral()
    maven {
        url "https://oss.sonatype.org/content/groups/public"
    }
}

At least until this version is publicly available on Maven Central.

Thnx for support.

@staleks
Copy link

staleks commented Apr 10, 2015

Now I have other problem with jmeter report in HTML format.

But let's open another issue for this.

NOTE: this one can be closed, since starting problem is not more an issue.

Thnx

@jk1
Copy link

jk1 commented Apr 26, 2015

I'm facing the same problem with 1.3.4-2.13 and gradle 2.3. My buildscript is as follows:

apply plugin: 'jmeter'

buildscript {
    repositories {mavenCentral()}

    dependencies {
        classpath "com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13"
    }
}

jmeterRun.configure {
     jmeterTestFiles = [file("req.jmx")]
 }

Running ./gradlew jmeterRun returns only "Something went wrong during jmeter test execution, Please see jmeter logs for more information" with no actual log to look into. Interestingly, jmeterListTestPlan works:

:testing:jmeterListTestPlan

Jmeter Test Plan
----------------
req.jmx

BUILD SUCCESSFUL

@foragerr
Copy link
Contributor

@jk1 Where is your req.jmx file located? If it is in /src/test/jmeter, then can you please comment out the jmeterTestFiles = line in your build.gradle?

@jk1
Copy link

jk1 commented Apr 27, 2015

@foragerr, thanks for looking into this. I've tried with jmeterTestFiles = ... line removed, but it doesn't seem to make any difference. Here's the minimal example, that reproduces the problem in my environment: https://github.com/jk1/Jmeter-plugin-demo

@foragerr
Copy link
Contributor

@jk1 Thank for the minimal example, certainly makes debugging easier :)

I ran jmeterrun on your example and got this:

java.lang.RuntimeException: Could not read JMeter properties file:\src\test\jmeter\jmeter.properties
    at org.apache.jmeter.util.JMeterUtils.loadJMeterProperties(JMeterUtils.java:193)
    at org.apache.jmeter.JMeter.initializeProperties(JMeter.java:527)
    at org.apache.jmeter.JMeter.start(JMeter.java:299)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.jmeter.NewDriver.main(NewDriver.java:264)
An error occurred: Could not read JMeter properties file:\src\test\jmeter\jmeter.properties
:jmeterRun FAILED

FAILURE: Build failed with an exception.

This is a known issue #38 , fix is waiting for a pull request #47 to be accepted.

The workaround is to add a jmeter.properties file in either /src/test/jmeter or using jmeterPropertyFile setting, to point to a properties file. Even a blank properties file is fine.

I'm more curious about why you didn't see the error stack trace when you ran jmeterRun. try running gradle with --info or --debug?

@jk1
Copy link

jk1 commented Apr 28, 2015

@foragerr, that's a good question. I've tried the same code in a clean virtual environment and it works exactly as you're describing, printing:

java.lang.RuntimeException: Could not read JMeter properties file:/home/user/test/jmeter.properties
        at org.apache.jmeter.util.JMeterUtils.loadJMeterProperties(JMeterUtils.java:193)
        at org.apache.jmeter.JMeter.initializeProperties(JMeter.java:527)
        at org.apache.jmeter.JMeter.start(JMeter.java:299)

so I suppose it's an issue with my laptop or OS configuration and not with the plugin.
Thanks a lot for your helpful advice, with jmeter.properties in place it seems to be working quite fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants