# How do i include dependencies in the pom when publishing a war?

**URL:** <https://discuss.gradle.org/t/how-do-i-include-dependencies-in-the-pom-when-publishing-a-war/5182>\
**Category:** Old Forum Archive\
**Created:** [November 25, 2014, 7:25am UTC](https://discuss.gradle.org/t/how-do-i-include-dependencies-in-the-pom-when-publishing-a-war/5182 "2014-11-25T07:25:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elygre](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@elygre](https://discuss.gradle.org/u/elygre)\
**Post date:** [November 25, 2014, 7:25am UTC](https://discuss.gradle.org/t/how-do-i-include-dependencies-in-the-pom-when-publishing-a-war/5182/1 "2014-11-25T07:25:00Z")

</div>

I want to publish a war-artifact, while still including all the dependencies in the generated war-file

If I create a publication based on “[components.web](http://components.web)”, the POM-file has no dependencies. This is described in [http://www.gradle.org/docs/current/userguide/publishing\_maven.html#publishing\_maven:publications](http://www.gradle.org/docs/current/userguide/publishing_maven.html#publishing_maven:publications), and is thus working as documented.

What I am trying to achieve is that the POM-file in fact does reference the dependencies, similar to what you can see in [https://repo1.maven.org/maven2/org/activiti/activiti-webapp-explorer2/5.16.4/activiti-webapp-explorer2-5.16.4.pom](https://repo1.maven.org/maven2/org/activiti/activiti-webapp-explorer2/5.16.4/activiti-webapp-explorer2-5.16.4.pom). Here, packaging=war, but the dependencies-section still lists everything required to build it.

Eirik

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 25, 2014, 3:31pm UTC](https://discuss.gradle.org/t/how-do-i-include-dependencies-in-the-pom-when-publishing-a-war/5182/2 "2014-11-25T15:31:00Z")

</div>

You might have to use ‘myPublication.pom.withXml’ and add the dependencies yourself. What’s the use case?

---

<div class="post-metadata">

**Author:** ![elygre](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@elygre](https://discuss.gradle.org/u/elygre)\
**Post date:** [November 26, 2014, 6:20pm UTC](https://discuss.gradle.org/t/how-do-i-include-dependencies-in-the-pom-when-publishing-a-war/5182/3 "2014-11-26T18:20:00Z")

</div>

We are trying to tie together a development environment where we want the user to a) have access to the war file content (html, web-inf, etc), and b) have a rich understanding of the dependencies that went into the war file.

We are currently looking at building two publications instead, one of the jar-file (which includes dependencies) and one of the war-file (without dependencies).

It’s not clear to me exactly what is “the right thing to do” with respect to war file POM’s, but since we saw the activiti-explorer war including dependencies, we wondered if that could also be easily solved with gradle.
