How Do I Use Maven to Install Windward Java Engine in my Application?
Windward's Java Report Engine is updated for each general release with its current code packaged in the Maven repository. This allows you to easily add the Windward Java Report Engine to your project without the need to coding a build script for the Windward libraries. We know many of you use Maven and the request was heard loud and clear. Follow the instructions below to easily add the Windward Java Report Engine to your Java application and get started generating your reports in no time!
To learn more about Maven a good overview is posted here.
In order to take advantage of the Maven project management and comprehension tool there are a few things you will need
Install the latest Java SE JDK
- If you have not already done so, download and install the latest Java SE Java Development Kit (JDK) from the prerequisites link above. Keep in mind you need the JDK and not the JRE.
- Make sure that you have correctly set your JAVA_HOME environment variable to the root JDK installation directory for your operating system.
- You can use the following command to check what the JAVA_HOME environment variable is currently set.
- Open a command prompt on your system
- For Windows the default should be C:\Program Files\Java\jdkX.X.X_XX. Note if you are using 64 bit Windows and installed the 32 bit JDK, it will appear under C:\Program Files(x86)\Java\jdkX.X.X_XX
Download and Install Apache Maven
- Download and install Apache Maven from the link below.
- Follow the Maven installation instructions for your operating system from the link below. Use the binary install but if you are compiling Maven then use the source installation.
- Unzip the Maven binaries or source to a directory of your choice. The default is apache-maven-x.x.x.
- Add the bin directory under your apache-maven-x.x.x install to your PATH environment variable. This ensures you can run Maven commands from anywhere in the command prompt.
Note: If you are not familiar with setting system environment variables go here to the bottom of the page and follow the instructions for your operating system
- Confirm you can run Maven command by opening a command prompt and entering the command below
- If you are successful you should see the following output with minor differences for your installed version of Maven.
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)Maven home: C:\Maven\apache-maven-3.3.9\bin\..
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.8.0_91\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "x86", family: "dos"
Configure Maven Properties and Settings
Locate your settings.xml file
- This file is typically located in
- Windows: %USERPROFILE%\.m2\settings.xml
- If do not find settings.xml, copy the default settings file from your <MAVEN INSTALL DIRECTORY>\conf to one of the locations above in step a.
Windows Users: If you do not find the .m2 directory under your username directory then run Maven without parameters from the command prompt to initialize the paths and directories structures. I.E. PROMPT>mvn
Add the Windward Maven Repository Settings to your settings.xml file.
- Open your settings.xml file and add the Windward profile code below between the <profiles> </profiles> section.
<profile> <id>windward-profile</id> <repositories> <repository> <id>windward-maven-repo</id> <name>windward-maven-repo-release</name> <url>http://maven-repository.windward.net/artifactory/libs-release-local</url> </repository> </repositories> </profile>
- Then add the code below for the profile you just created to the active profiles section between <activeProfiles> </activeProfiles> and save settings.xml.
Add the Windward version dependency to your Java project pom.xml file
- In your current application locate and open the pom.xml file and add the following Windward dependency.
<dependency> <groupId>net.windward</groupId> <artifactId>WindwardReports</artifactId> <version>VERSION_NUMBER</version> </dependency>
- Replace VERSION_NUMBER with the version of the Windward Java Engine you want to use. (Example: 22.214.171.124)