Stand Back: I’m Going To Use Maven
Some might say these words are a dangerous statement to make. I went down the path of installing the Maven build system on Fedora 21. Based on my prior experience, I thought it was going to be a trip. To my surprise and delight, I managed to get it working much quicker than I had first thought.
The second installment of my Maven journey wasn’t as smooth as I would have liked. But as you’ll read, there is progress being made.
Maven is a build system that practically all JBoss Products use in the upstream.
The great thing is that it’s easy to install on Fedora.
sudo yum install maven
Check the JDK
After you install the package, running
mvn --version will likely cause something like the following message to display.
mvn --version Error: JAVA_HOME is not defined correctly. We cannot execute /usr/java/jdk1.7.0_17/bin/java
So what now? Well, maven requires a Java Development Kit. As you can see I have a JDK installed. Pffff.
Check the PATH in .bashrc
Suggestions on StackOverflow lead me to believe that all I needed to do was set JAVA_HOME to the correct JDK.
1.8.0 is the latest Oracle JDK on Fedora 21. That wasn’t enough though. I needed to also set PATH in my .bashrc file. This is where the problem was for me: I had an old JDK declared in the .bashrc file that had been carried over from previous versons of my OS as I upgraded.
## Environment Variables export JAVA_HOME=/usr/java/jdk1.7.0_17 PATH=$JAVA_HOME/bin/java:$PATH export PATH
I changed this to the following:
## Environment Variables export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk PATH=$JAVA_HOME/bin/java:$PATH export PATH
This allowed me to execute
mvn --version and get the following output:
mvn --version OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0 Apache Maven 3.2.2 (NON-CANONICAL_2014-06-19T11:19:24_mockbuild; 2014-06-19T21:19:24+10:00) Maven home: /usr/share/maven Java version: 1.8.0_31, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-1.8.0-openjdk-18.104.22.168-3.b13.fc21.x86_64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.18.5-201.fc21.x86_64", arch: "amd64", family: "unix"
This verifies that the basic Maven install works as expected.
Build the API Docs!
Well. Colour me surprised.
I am now able to continue on with what I wanted to do in the first place: download the RHQ project Git Repo, and build the API Docs. Getting Maven installed and functioning is not nearly as hard as I remembered. Maybe that has a bit to do with my experience at Red Hat. Maybe it has a bit to do with improvements made to Maven over the years since I last used it.
Tune in to the next episode for how that went…