Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Java class required #44

Open
juasiepo opened this issue Mar 25, 2015 · 3 comments
Open

Java class required #44

juasiepo opened this issue Mar 25, 2015 · 3 comments

Comments

@juasiepo
Copy link

I am installing java by uncompressing it in a specific folder and updating the JAVA_HOME and not using the rpm/yum java based. While trying to download and artifact using maven, it fails and the log shows:
Could not evaluate: mvn returned 1: Is Maven installed?

The "funny thing" s that if I run the exec command shown on logs manually it works perfectly but not while it runs through puppet.

puppet-maven seems to need the rpm/yum java version somehow and doesn't like my approach. Any Idea how can I make it compatible? the other option I can think is that there is some environment variable not set. Who knows.... :)

Thanks for your time

@carlossg
Copy link
Member

Probably the path used by puppet and exec are different. Maven also uses JAVA_HOME

@juasiepo
Copy link
Author

Yes, I thought that to so I populated the JAVA_HOME using the module's parameter $maven_opts but still no luck

@riman
Copy link

riman commented Oct 24, 2016

Hi.
I ran into this issue too.
If Java is installed by decompressing jdk-version.tar.gz into (for ex.) /opt/jdk then Maven would not work.
I tried setting maven::environment as:

maven::environment { 'maven-env' :
    # anything to add to MAVEN_OPTS in ~/.mavenrc
    user => 'root',
    maven_opts           => '-Xmx1384m',       # anything to add to MAVEN_OPTS in ~/.mavenrc
    maven_path_additions => "/opt/jdk/jdk$jdk_version/bin",      # anything to add to the PATH in ~/.mavenrc
    mavenrc_additions => "export JAVA_HOME=/opt/jdk/jdk$jdk_version"
  } ->

but it didn't help either.

The error reads as:

Error: ["mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DgroupId=com.mycompany -DartifactId=theapp -Dversion=1.2.5 -DremoteRepositories=http://buildserver:port/public -Ddest=/dir/theapp-1.2.5.jar -Dtransitive=false -Ppuppet-maven "] returned 1: Error: JAVA_HOME is not defined correctly.
We cannot execute

If JAVA_HOME is exported in /root/.bashrc as

export JAVA_HOME=...
export PATH=$JAVA_HOME/bin:$PATH

before running puppet agent then everything work OK.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants