Maven

From Documentation



Stop.png This article is out of date, please refer to http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials for more up to date information.


This section describes the Maven settings required to use ZK Spreadsheet in your application. Please refer to this article for the Maven settings for ZK Framework.

Dependencies

ZK Spreadsheet OSE

<dependency>
	<groupId>org.zkoss.poi</groupId>
	<artifactId>zpoi</artifactId>
	<version>3.8.1</version>
</dependency>
<dependency>
	<groupId>org.zkoss.zss</groupId>
	<artifactId>zss</artifactId>
	<version>2.5.0</version>
</dependency>

ZK Spreadsheet EE

<dependency>
	<groupId>org.zkoss.poi</groupId>
	<artifactId>zpoiex</artifactId>
	<version>3.8.1</version>
</dependency>
<dependency>
	<groupId>org.zkoss.zss</groupId>
	<artifactId>zssex</artifactId>
	<version>2.5.0</version>
</dependency>
<!-- Export to PDF -->
<dependency>
	<groupId>org.zkoss.zss</groupId>
	<artifactId>zsspdf</artifactId>
	<version>2.5.0</version>
</dependency>
<!-- Export to HTML -->
<dependency>
	<groupId>org.zkoss.zss</groupId>
	<artifactId>zsshtml</artifactId>
	<version>2.5.0</version>
</dependency>
<!-- ZK Spreadsheet JSP Tag -->
<dependency>
	<groupId>org.zkoss.zss</groupId>
	<artifactId>zssjsp</artifactId>
	<version>2.5.0</version>
</dependency>
<!-- ZK Spreadsheet As JSF Component -->
<dependency>
	<groupId>org.zkoss.zss</groupId>
	<artifactId>zssjsf</artifactId>
	<version>2.5.0</version>
</dependency>

Repository

Evaluating users (ZK Spreadsheet EE-eval)

For evaluation

 <repositories>
    <repository>
      <id>ZK Spreadsheet EE Evaluation</id>
      <url>http://mavensync.zkoss.org/eval/</url>
    </repository>
  </repositories>

Sample of pom.xml for evaluation

Here is sample pom.xml for a simple Java project that uses the ZK Spreadsheet.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>sample</groupId>
	<artifactId>zss.maven</artifactId>
	<properties>
		<zpoi.version>3.8.1</zpoi.version>
		<zss.version>2.5.0</zss.version>
		<zk.version>6.5.0</zk.version>
	</properties>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>eval Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<repositories>
		<repository>
			<id>ZSS eval</id>
			<url>http://mavensync.zkoss.org/eval/</url>
		</repository>
	</repositories>
	<dependencies>
		<!-- ZSS -->
		<dependency>
			<groupId>org.zkoss.poi</groupId>
			<artifactId>zpoi</artifactId>
			<version>${zpoi.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.poi</groupId>
			<artifactId>zpoiex</artifactId>
			<version>${zpoi.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zss</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zssex</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zsspdf</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zsshtml</artifactId>
			<version>${zss.version}</version>
		</dependency>		
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zssjsp</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zssjsf</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<!-- ZK -->
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zul</artifactId>
			<version>${zk.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zkex</artifactId>
			<version>${zk.version}</version>
		</dependency>
	</dependencies>
</project>

Premium users only

<repositories>
	<repository>
		<id>ZK EE</id>
		<url>https://maven.zkoss.org/repo/zk/ee</url>
	</repository>
</repositories>

Login authentication

Please refer to the official documentation of Apache Maven project for storing login authentication credential in the global settings file.

  • Location (if not already existed, you can create it manually)
    • Maven installation root: $M2_HOME/conf/settings.xml - OR -
    • User's Maven root: ${user.home}/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
		http://maven.apache.org/xsd/settings-1.0.0.xsd">
	<servers>
		<server>
			<id>ZK EE</id><!-- Same as the repository name used in your pom.xml -->
			<!-- Please replace the following with your premium username and password -->
			<username>premium</username>
			<password>2k0553cr3t</password>
		</server>
	</servers>
</settings>

Sample of pom.xml for licensed ZK Spreadsheet EE Package

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>zss</groupId>
	<artifactId>sample</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<properties>
		<zk.version>6.5.2</zk.version>
		<zkpoi.version>3.8.1</zkpoi.version>
		<zss.version>2.5.0</zss.version>
	</properties>
	<packaging>war</packaging>
	<name>The sample Project</name>
	<repositories>
		<repository>
			<id>ZK CE</id>
			<name>ZK CE Repository</name>
			<url>http://mavensync.zkoss.org/maven2</url>
		</repository>
		<repository>
			<id>ZK EE</id>
			<url>https://maven.zkoss.org/repo/zk/ee</url>
		</repository>
	</repositories>
	<dependencies>
		<!-- ZK Spreadsheet OSE -->
		<dependency>
			<groupId>org.zkoss.poi</groupId>
			<artifactId>zpoi</artifactId>
			<version>${zkpoi.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zss</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<!-- ZK Spreadsheet EE -->
		<dependency>
			<groupId>org.zkoss.poi</groupId>
			<artifactId>zpoiex</artifactId>
			<version>${zkpoi.version}</version>
		</dependency>
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zssex</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<!-- Export to PDF -->
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zsspdf</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<!-- Export to HTML -->
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zsshtml</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<!-- ZK Spreadsheet As JSF Component -->
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zssjsf</artifactId>
			<version>${zss.version}</version>
		</dependency>
		<!-- ZK Spreadsheet JSP Tag -->
		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zssjsp</artifactId>
			<version>${zss.version}</version>
		</dependency>
		
		<!-- ZK -->
        <dependency>
            <groupId>org.zkoss.zk</groupId>
            <artifactId>zul</artifactId>
            <version>${zk.version}</version>
        </dependency>
        <dependency>
            <groupId>org.zkoss.zk</groupId>
            <artifactId>zkplus</artifactId>
            <version>${zk.version}</version>
        </dependency>
        <dependency>
            <groupId>org.zkoss.zk</groupId>
            <artifactId>zkex</artifactId>
            <version>${zk.version}</version>
        </dependency>
        
        <!-- JSF dependency -->
        <dependency>
			<groupId>javax.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.0</version>
		</dependency>
	</dependencies>
</project>

Troubleshooting

If you have problem switching from the evaluation repository to the licensed one, please check the followings:

Purge local repository evaluation cache
  • 1. Add purge-local-repository plugin in pom.xml
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.6</version>
				<executions>
					<execution>
						<id>purge-local-dependencies</id>
						<phase>clean</phase>
						<goals>
							<goal>purge-local-repository</goal>
						</goals>
						<configuration>
							<manualIncludes>
								<manualInclude>org.zkoss.zk:zkex</manualInclude>
								<manualInclude>org.zkoss.poi:zpoiex</manualInclude>
								<manualInclude>org.zkoss.zss:zssex</manualInclude>
								<manualInclude>org.zkoss.zss:zsshtml</manualInclude>
								<manualInclude>org.zkoss.zss:zssjsf</manualInclude>
								<manualInclude>org.zkoss.zss:zssjsp</manualInclude>
								<manualInclude>org.zkoss.zss:zsspdf</manualInclude>
							</manualIncludes>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
  • 2. Invoke maven clean to delete local repository evaluation cache
mvn clean

All source code listed in this book is at Github.


Last Update : 2017/03/13

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.