# Question about adding war archive to ear archive

**URL:** <https://discuss.gradle.org/t/question-about-adding-war-archive-to-ear-archive/6285>\
**Category:** Old Forum Archive\
**Created:** [April 23, 2014, 7:33pm UTC](https://discuss.gradle.org/t/question-about-adding-war-archive-to-ear-archive/6285 "2014-04-23T19:33:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavan](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@Pavan](https://discuss.gradle.org/u/Pavan)\
**Post date:** [April 23, 2014, 7:33pm UTC](https://discuss.gradle.org/t/question-about-adding-war-archive-to-ear-archive/6285/1 "2014-04-23T19:33:00Z")

</div>

Hi Nikolay/Rene,   
  
 I have a question in creating ear file. I have a requirement to add the war file under ear file and few other folder/files along with it.   
 I verified few articles, posting and Gradle guide which says to add the below command under dependencies   
  
 deploy project(path: ‘:war’, configuration: ‘archives’)   
  
 But when I try this then I am getting an exception. Could you please guide me on how to add war file under ear.   
  
 Thanks   
 Pavan Note: This topic was created from a [reply](http://forums.gradle.org/gradle/topics/ear_build_with_specific_appdirname_path/replies/14195096) on the [Ear build with specific appDirName path](http://forums.gradle.org/gradle/topics/ear_build_with_specific_appdirname_path) topic.

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [April 23, 2014, 9:04pm UTC](https://discuss.gradle.org/t/question-about-adding-war-archive-to-ear-archive/6285/2 "2014-04-23T21:04:00Z")

</div>

What exception do you get?

---

<div class="post-metadata">

**Author:** ![Pavan](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@Pavan](https://discuss.gradle.org/u/Pavan)\
**Post date:** [April 23, 2014, 9:08pm UTC](https://discuss.gradle.org/t/question-about-adding-war-archive-to-ear-archive/6285/3 "2014-04-23T21:08:00Z")

</div>

Hi Rene,

Thanks for your response. Below is the exception which I am getting

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.

BUILD FAILED

Total time: 7.186 secs

Thanks Pavan

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [April 24, 2014, 10:16am UTC](https://discuss.gradle.org/t/question-about-adding-war-archive-to-ear-archive/6285/4 "2014-04-24T10:16:00Z")

</div>

Hi Pavan

in the snippet

```gradle
deploy project(path: ':war', configuration: 'archives')

```

‘:war’ is referencing your war project. It seems that your war project has a different name. you must replace ‘:war’ with the correct project path.

---

<div class="post-metadata">

**Author:** ![Pavan](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@Pavan](https://discuss.gradle.org/u/Pavan)\
**Post date:** [April 28, 2014, 10:37pm UTC](https://discuss.gradle.org/t/question-about-adding-war-archive-to-ear-archive/6285/5 "2014-04-28T22:37:00Z")

</div>

Hi Rene,

Thanks for the reply. Sorry that I was out of station so responding late. Here is the code snippet which I am using. Please advice.

apply plugin: ‘java’ apply plugin: ‘war’ apply plugin: ‘eclipse’ apply plugin: ‘ear’

dependencies {

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

deploy project(path: “:erim”, configuration: “archives”)

}

war {

from(‘WebRoot/WEB-INF’){

include ‘\*.xml’

into (‘WEB-INF/’)

}

into (‘WEB-INF/jsp’){

from ‘WebRoot/WEB-INF/jsp’

}

into (‘WEB-INF/tags’){

from ‘WebRoot/WEB-INF/tags’

}

into (‘javaScript’){

from ‘WebRoot/javaScript’

}

into (‘images’){

from ‘WebRoot/images’

}

into (‘css’){

from ‘WebRoot/css’

}

from(‘WebRoot’){

include ‘_._’

into (’’)

}

exclude(“WEB-INF/lib/classes12.jar”) }

sourceSets {

main{

java {

srcDir ‘src’

}

} }

ear {

deploymentDescriptor {

webModule(project(":erim").war.archiveName, “customContextPath”)

} }

ear.baseName=‘erim’

Thanks Pavan
