How to handle required Java version?


#1

Nexus cookbook https://github.com/RiotGamesCookbooks/nexus-cookbook
leverages the Java cookbook https://github.com/agileorbit-cookbooks/java,
but Nexus requires at least Java 7.

I came across this code & comment
https://github.com/RiotGamesCookbooks/nexus-cookbook/issues/41#issuecomment-22027060
and while it worked, they didn’t seem happy with the solution.

I’m curious if there’s a better way to handle this scenario?

Thanks!
Greg


#2

We use the Java cookbook all the time, and this, in your cookbook’s attributes/default.rb should be sufficient (works well for us):

default[‘java’][‘install_flavor’] = 'oracle’
default[‘java’][‘jdk_version’] = '7’
default[‘java’][‘oracle’][‘accept_oracle_download_terms’] = true

You’ll need to also include_recipe ‘java’ in your recipe somewhere as well, but that’s all that should be needed.

Of course, change the values to suit, and you don’t need the node[‘java’][‘oracle’][‘accept_oracle_download_terms’] attribute if you’re not using Oracle’s JDK.

This is how the Java cookbook is designed to work, and we have no trouble at all using it this way.


Jeff Byrnes
@berkleebassist
Lead DevOps Engineer
EverTrue
704.516.4628

On January 13, 2015 at 9:15:30 PM, Greg Barker (fletch@fletchowns.net) wrote:

Nexus cookbook leverages the Java cookbook, but Nexus requires at least Java 7.

I came across this code & comment and while it worked, they didn’t seem happy with the solution.

I’m curious if there’s a better way to handle this scenario?

Thanks!
Greg


#3

Thanks Jeff. It seems like that’s how they thought it should work, but they
also had to duplicate that logic from the java cookbook to set the
java_home and openjdk_packages attributes, because of the way attributes
are loaded. Are you saying that is unnecessary?

On Wed, Jan 14, 2015 at 6:29 AM, Jeff Byrnes jeff@evertrue.com wrote:

We use the Java cookbook all the time, and this, in your cookbook’s
attributes/default.rb should be sufficient (works well for us):

default[‘java’][‘install_flavor’] = 'oracle’
default[‘java’][‘jdk_version’] = '7’
default[‘java’][‘oracle’][‘accept_oracle_download_terms’] = true

You’ll need to also include_recipe ‘java’ in your recipe somewhere as
well, but that’s all that should be needed.

Of course, change the values to suit, and you don’t need the
node[‘java’][‘oracle’][‘accept_oracle_download_terms’] attribute if you’re
not using Oracle’s JDK.

This is how the Java cookbook is designed to work, and we have no trouble
at all using it this way.


Jeff Byrnes
@berkleebassist http://twitter.com/berkleebassist
Lead DevOps Engineer
EverTrue http://www.evertrue.com/
704.516.4628

On January 13, 2015 at 9:15:30 PM, Greg Barker (fletch@fletchowns.net)
wrote:

Nexus cookbook https://github.com/RiotGamesCookbooks/nexus-cookbook
leverages the Java cookbook https://github.com/agileorbit-cookbooks/java,
but Nexus requires at least Java 7.

I came across this code & comment
https://github.com/RiotGamesCookbooks/nexus-cookbook/issues/41#issuecomment-22027060
and while it worked, they didn’t seem happy with the solution.

I’m curious if there’s a better way to handle this scenario?

Thanks!
Greg


#4

As far as I’m aware, yes, that’s unnecessary. We’ve not had any difficulty ourselves, but, as always, YMMV.


Jeff Byrnes
@berkleebassist
Lead DevOps Engineer
EverTrue
704.516.4628

On January 14, 2015 at 1:28:39 PM, Greg Barker (fletch@fletchowns.net) wrote:

Thanks Jeff. It seems like that’s how they thought it should work, but they also had to duplicate that logic from the java cookbook to set the java_home and openjdk_packages attributes, because of the way attributes are loaded. Are you saying that is unnecessary?

On Wed, Jan 14, 2015 at 6:29 AM, Jeff Byrnes jeff@evertrue.com wrote:
We use the Java cookbook all the time, and this, in your cookbook’s attributes/default.rb should be sufficient (works well for us):

default[‘java’][‘install_flavor’] = 'oracle’
default[‘java’][‘jdk_version’] = '7’
default[‘java’][‘oracle’][‘accept_oracle_download_terms’] = true

You’ll need to also include_recipe ‘java’ in your recipe somewhere as well, but that’s all that should be needed.

Of course, change the values to suit, and you don’t need the node[‘java’][‘oracle’][‘accept_oracle_download_terms’] attribute if you’re not using Oracle’s JDK.

This is how the Java cookbook is designed to work, and we have no trouble at all using it this way.


Jeff Byrnes
@berkleebassist
Lead DevOps Engineer
EverTrue
704.516.4628

On January 13, 2015 at 9:15:30 PM, Greg Barker (fletch@fletchowns.net) wrote:

Nexus cookbook leverages the Java cookbook, but Nexus requires at least Java 7.

I came across this code & comment and while it worked, they didn’t seem happy with the solution.

I’m curious if there’s a better way to handle this scenario?

Thanks!
Greg