Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper way to install/run a gradle plugin from github (specifically the arquilian plugin)?

Tags:

gradle

I would like to use the arquillian plugin here to run jetty 8+:

https://github.com/aslakknutsen/arquillian-gradle-plugin

If I put "apply plugin: 'arquillian'" in my gradle script, it does not find it.

So I must have to install it somehow. I look for info on this, but did not find.

Would you have a pointer on how to do that?

I am using gradle 1.6 on windows.


Update after answer by @raeffs: I updated the gradle script with it and the build is successfull, but I don't see my war started after an arquillianRunJetty (port 8080 is not even listening).

Then I tried to add what is indicated on the github page:

arquillian {
    debug = true
    deployable = file('my/path/arbitraryWebApp.war')

    containers {
        jetty {
            version = '8'
            type = 'embedded'
            config = ['bindHttpPort': 8080, 'bindAddress': '127.0.0.1', 'jettyPlus': false]

            dependencies {
                adapter 'org.jboss.arquillian.container:arquillian-jetty-embedded-7:1.0.0.CR2'
                container 'org.eclipse.jetty:jetty-webapp:8.1.11.v20130520'
                container group: 'org.eclipse.jetty', name: 'jetty-plus', version: '8.1.11.v20130520'
            }
        }

I had to replace arquillian-jetty-embedded-7:1.0.0.CR2 with CR1 as it is not in maven central.

Then I put the path to my war. When starting again, there is more chatter but still no listening on port 8080.

So I still miss something.

I also find awkward to have to reference with an absolute path for the war I am building with the gradle script. I think there could be a kind of self reference.

Update It is running fine now thanks to @raeffs. I don't really know what was wrong in my previous step.

The path to the web app takes the name, plus the version.

Thank you

like image 981
unludo Avatar asked Jun 27 '13 08:06

unludo


1 Answers

The creator of the plugin has not published it to a maven repository, so you have to build it on your own.

Get a local copy of the plugin project and build it. You should get a the 'arquillian-gradle-plugin-0.1.jar' as output.

In the build script of yout own project you have to declare a dependency to that jar. Add the following to your build script:

buildscript {
    dependencies {
        classpath fileTree(dir: '/path/to/folder/that/contains/the/jar',
            includes: ['arquillian-gradle-plugin-0.1.jar'])
    }
}

Now you should be able to use the plugin.

Update

If you do not want to provide a hardcoded path to your deployable you could simply pass a variable. For example if you are using the war plugin:

arquillian {
    deployable = war.archivePath
}

Here is an example of the usage: https://gist.github.com/raeffs/5920562#file-build-gradle

It starts the jetty container, deploys the war and waits until ctrl+c is pressed.

like image 113
raeffs Avatar answered Oct 15 '22 04:10

raeffs