# AppDirName not working for type Ear

**URL:** <https://discuss.gradle.org/t/appdirname-not-working-for-type-ear/1399>\
**Category:** Old Forum Archive\
**Created:** [November 26, 2012, 11:08am UTC](https://discuss.gradle.org/t/appdirname-not-working-for-type-ear/1399 "2012-11-26T11:08:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heiko1](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@Heiko1](https://discuss.gradle.org/u/Heiko1)\
**Post date:** [November 26, 2012, 11:08am UTC](https://discuss.gradle.org/t/appdirname-not-working-for-type-ear/1399/1 "2012-11-26T11:08:00Z")

</div>

Hello I have some problems with the ear plugin. In one project I generate 2 different Ears which a defined that way:

```gradle
import org.gradle.plugins.ear.*
task earApplication(type: Ear, dependsOn: createEjb)
  earApplication {
   appDirName 'Implementation/resources/application'
   baseName += '-app'
}

```

This leads to the following exception: [Fatal Error] :1:1: Content is not allowed in prolog.

Deactivating the appDirName works fine.

Thanks, Heiko

---

<div class="post-metadata">

**Author:** ![Detelin](https://avatars.discourse-cdn.com/v4/letter/d/3e96dc/32.png) [@Detelin](https://discuss.gradle.org/u/Detelin)\
**Post date:** [November 27, 2012, 12:28am UTC](https://discuss.gradle.org/t/appdirname-not-working-for-type-ear/1399/2 "2012-11-27T00:28:00Z")

</div>

It’s probably due to the implementation of the [EarPluginConvention.setAppDirName](http://gradle.org/docs/current/groovydoc/org/gradle/plugins/ear/EarPluginConvention.html#setAppDirName%28java.lang.String%29) method:

```gradle
public void setAppDirName(String appDirName) {
 this.appDirName = appDirName
 if (deploymentDescriptor) {
  deploymentDescriptor.readFrom new File(appDirName, "META-INF/" + deploymentDescriptor.fileName)
 }
}

```

Above will always attempt to read a ‘META-INF/application.xml’ file from the specified ‘appDirName’ directory if it exists. Do you have such file under ‘Implementation/resources/application’? If so, probably it is not a valid XML file. Could you paste the full stack trace?

---

<div class="post-metadata">

**Author:** ![Heiko1](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@Heiko1](https://discuss.gradle.org/u/Heiko1)\
**Post date:** [November 27, 2012, 11:15am UTC](https://discuss.gradle.org/t/appdirname-not-working-for-type-ear/1399/3 "2012-11-27T11:15:00Z")

</div>

Hi Detelin You are right. I have an application.xml under

```
Implementation/resources/application
```
. Which produced this problem. Good hint. After that I understood also, that I can overwrite automatically generated entries in the deploymentDescriptor. This wasn’t clear to me.

Finally I removed the application.xml and added an webModule entry to the deploymentDescriptor. Thanks again for your help. Heiko
