# Berkshelf installs additional java

**URL:** <https://discourse.chef.io/t/berkshelf-installs-additional-java/6294>\
**Category:** Chef Infra (archive)\
**Created:** [February 13, 2015, 3:42pm UTC](https://discourse.chef.io/t/berkshelf-installs-additional-java/6294 "2015-02-13T15:42:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charles\_Betz](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@Charles\_Betz](https://discourse.chef.io/u/Charles_Betz)\
**Post date:** [February 13, 2015, 3:42pm UTC](https://discourse.chef.io/t/berkshelf-installs-additional-java/6294/1 "2015-02-13T15:42:09Z")

</div>

Have a base build in Vagrant with Oracle Java 7 pre-installed. (I created a  
wrapper cookbook for the community Java cookbook and successfully used  
attributes to override the OpenJDK 6 default.)

Using the community Ant recipe. It specifies a Java dependency. Because of  
this, Berkshelf additionally installs OpenJDK 7 which causes build  
confusion.

I created a wrapper cookbook for Ant and specified the Oracle attributes in  
it hoping that transitive Java install would take these attributes, but no  
dice.

Lots of Googling before I turned here. The Java cookbook suggests that  
consuming cookbooks allow for such an override but the Ant cookbook doesn’t  
seem to allow it.

Am I overlooking some aspect of how to correctly configure metadata and the  
Berksfile? It’s not a simple semver revision level problem.

At this point it seems I need to just install Ant with shell exec.

This is with Vagrant Berkshelf plugin driven by a Vagrantfile, not a ChefDK  
kitchen.yml.

Thanks for any assistance.

Charlie

---

<div class="post-metadata">

**Author:** ![Medya](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/medya/32/96_2.png) [@Medya](https://discourse.chef.io/u/Medya)\
**Post date:** [February 13, 2015, 6:41pm UTC](https://discourse.chef.io/t/berkshelf-installs-additional-java/6294/2 "2015-02-13T18:41:03Z")

</div>

That cookbook needs to be rewritten with LWRPs, instead of recipes, to  
avoid this kind of problems.  
I ended up creating my own java cookbook.

On Fri, Feb 13, 2015 at 9:42 AM, Charles Betz [char@erp4it.com](mailto:char@erp4it.com) wrote:

> Have a base build in Vagrant with Oracle Java 7 pre-installed. (I created  
> a wrapper cookbook for the community Java cookbook and successfully used  
> attributes to override the OpenJDK 6 default.)
> 
> Using the community Ant recipe. It specifies a Java dependency. Because of  
> this, Berkshelf additionally installs OpenJDK 7 which causes build  
> confusion.
> 
> I created a wrapper cookbook for Ant and specified the Oracle attributes  
> in it hoping that transitive Java install would take these attributes, but  
> no dice.
> 
> Lots of Googling before I turned here. The Java cookbook suggests that  
> consuming cookbooks allow for such an override but the Ant cookbook doesn't  
> seem to allow it.
> 
> Am I overlooking some aspect of how to correctly configure metadata and  
> the Berksfile? It's not a simple semver revision level problem.
> 
> At this point it seems I need to just install Ant with shell exec.
> 
> This is with Vagrant Berkshelf plugin driven by a Vagrantfile, not a  
> ChefDK kitchen.yml.
> 
> Thanks for any assistance.
> 
> Charlie

---

<div class="post-metadata">

**Author:** ![Charles\_Betz](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@Charles\_Betz](https://discourse.chef.io/u/Charles_Betz)\
**Post date:** [February 13, 2015, 6:46pm UTC](https://discourse.chef.io/t/berkshelf-installs-additional-java/6294/3 "2015-02-13T18:46:59Z")

</div>

Thanks -- By "that cookbook" you mean the community Ant cookbook..?

On Fri, Feb 13, 2015 at 12:41 PM, Medya [medya.gh@gmail.com](mailto:medya.gh@gmail.com) wrote:

> That cookbook needs to be rewritten with LWRPs, instead of recipes, to  
> avoid this kind of problems.  
> I ended up creating my own java cookbook.
> 
> On Fri, Feb 13, 2015 at 9:42 AM, Charles Betz [char@erp4it.com](mailto:char@erp4it.com) wrote:
> 
> > Have a base build in Vagrant with Oracle Java 7 pre-installed. (I created  
> > a wrapper cookbook for the community Java cookbook and successfully used  
> > attributes to override the OpenJDK 6 default.)
> > 
> > Using the community Ant recipe. It specifies a Java dependency. Because  
> > of this, Berkshelf additionally installs OpenJDK 7 which causes build  
> > confusion.
> > 
> > I created a wrapper cookbook for Ant and specified the Oracle attributes  
> > in it hoping that transitive Java install would take these attributes, but  
> > no dice.
> > 
> > Lots of Googling before I turned here. The Java cookbook suggests that  
> > consuming cookbooks allow for such an override but the Ant cookbook doesn't  
> > seem to allow it.
> > 
> > Am I overlooking some aspect of how to correctly configure metadata and  
> > the Berksfile? It's not a simple semver revision level problem.
> > 
> > At this point it seems I need to just install Ant with shell exec.
> > 
> > This is with Vagrant Berkshelf plugin driven by a Vagrantfile, not a  
> > ChefDK kitchen.yml.
> > 
> > Thanks for any assistance.
> > 
> > Charlie

---

<div class="post-metadata">

**Author:** ![Eric\_Helgeson](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/eric_helgeson/32/67_2.png) [@Eric\_Helgeson](https://discourse.chef.io/u/Eric_Helgeson)\
**Post date:** [February 13, 2015, 7:39pm UTC](https://discourse.chef.io/t/berkshelf-installs-additional-java/6294/4 "2015-02-13T19:39:56Z")

</div>

Looks like there is a PR out there to have it optionally include java  
cookbook - [Optionally allow java to not be managed via the java cookbook. by bdclark · Pull Request #7 · jtimberman/ant-cookbook · GitHub](https://github.com/opscode-cookbooks/ant/pull/7)

The Java cookbook does provide the java\_ark resource which I use to install  
multiple jdks in jenkins -

> <https://github.com/erichelgeson/jenkins-chef-dsl/blob/master/recipes/build-jdks.rb>

Thanks,  
-Eric Helgeson  
@nulleric [https://twitter.com/nulleric](https://twitter.com/nulleric)  
[http://usingchef.com](http://usingchef.com)

On Fri, Feb 13, 2015 at 12:46 PM, Charles Betz [char@erp4it.com](mailto:char@erp4it.com) wrote:

> Thanks -- By "that cookbook" you mean the community Ant cookbook..?
> 
> On Fri, Feb 13, 2015 at 12:41 PM, Medya [medya.gh@gmail.com](mailto:medya.gh@gmail.com) wrote:
> 
> > That cookbook needs to be rewritten with LWRPs, instead of recipes, to  
> > avoid this kind of problems.  
> > I ended up creating my own java cookbook.
> > 
> > On Fri, Feb 13, 2015 at 9:42 AM, Charles Betz [char@erp4it.com](mailto:char@erp4it.com) wrote:
> > 
> > > Have a base build in Vagrant with Oracle Java 7 pre-installed. (I  
> > > created a wrapper cookbook for the community Java cookbook and successfully  
> > > used attributes to override the OpenJDK 6 default.)
> > > 
> > > Using the community Ant recipe. It specifies a Java dependency. Because  
> > > of this, Berkshelf additionally installs OpenJDK 7 which causes build  
> > > confusion.
> > > 
> > > I created a wrapper cookbook for Ant and specified the Oracle attributes  
> > > in it hoping that transitive Java install would take these attributes, but  
> > > no dice.
> > > 
> > > Lots of Googling before I turned here. The Java cookbook suggests that  
> > > consuming cookbooks allow for such an override but the Ant cookbook doesn't  
> > > seem to allow it.
> > > 
> > > Am I overlooking some aspect of how to correctly configure metadata and  
> > > the Berksfile? It's not a simple semver revision level problem.
> > > 
> > > At this point it seems I need to just install Ant with shell exec.
> > > 
> > > This is with Vagrant Berkshelf plugin driven by a Vagrantfile, not a  
> > > ChefDK kitchen.yml.
> > > 
> > > Thanks for any assistance.
> > > 
> > > Charlie
