How to create an ear file with war file inside


I am trying to create an ear file having war file inside. Below is the code which I am trying after looking at few examples.

dependencies {

compile fileTree(dir: ‘WebRoot/WEB-INF/lib’, includes:[’*.jar’])

deploy project(path: ‘:war’, configuration: ‘archives’)


When I try the above code, below is the error which I am gettting

C:\workspace-cord\ERIM>gradle build

FAILURE: Build failed with an exception.

  • Where: Build file ‘C:\workspace-cord\ERIM\build.gradle’ line: 8

  • What went wrong: A problem occurred evaluating root project ‘ERIM’. > Project with path ‘:war’ could not be found in root project ‘ERIM’.

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


Total time: 6.216 secs

Can someone help in resolving this.

Thanks Pavan