How to explicitly specify the path to and name of a .war file when deploying?


(J.V.) #1

When deploying a .war using the cargo plugin, I want to explicitly set the full path to and the name of the .war file.

How do I do this?

It defaults to <my_projeject>/app/build/libs/app.war

I tried creating a closure:

war {

archiveName=’/tmp/test.war’ }

but then I get an error:

<my_proj>/app/build/libs/tmp/test.war does not exist.

This is frustrating if anyone can help, the cargo documentation mentions nothing of the war { clousure or how to explicitly set the name of the war file to be deployed.

Any help would be appreciated.


(Benjamin Muschko) #2

As indicated by the plugin documentation, you can use the “deployable” configuration block.

Example:

cargo {
    deployable {
        file = file('/app/build/libs/tmp/test.war')
        context = 'yourcontext'
    }
}

(J.V.) #3

awesome, thanks, I will give it a go; is there a field to specify a URL (path to a .war, fetch with http:// ?)


(Benjamin Muschko) #4

Not at the moment. You will have to download it first to your local file system. The most convenient way to do this is to write a Gradle task that retrieves it via HTTP.