Using Maven"

From Documentation
(15 intermediate revisions by 4 users not shown)
Line 4: Line 4:
  
 
This section describes the Maven settings required to use ZK Pivottable in your application. Please refer to [http://books.zkoss.org/wiki/ZK_Installation_Guide/Setting_up_IDE/Maven/Resolving_ZK_Framework_Artifacts_via_Maven this article] for the Maven settings for ZK Framework.
 
This section describes the Maven settings required to use ZK Pivottable in your application. Please refer to [http://books.zkoss.org/wiki/ZK_Installation_Guide/Setting_up_IDE/Maven/Resolving_ZK_Framework_Artifacts_via_Maven this article] for the Maven settings for ZK Framework.
 +
 +
== Dependency ==
 +
 +
The dependency setting in your pom.xml stays the same regardless of your user status (evaluating or a premium customer).
 +
 +
<source lang="xml">
 +
<dependencies>
 +
<dependency>
 +
<groupId>org.zkoss.pivot</groupId>
 +
<artifactId>pivottable</artifactId>
 +
<version>2.5.1</version>
 +
</dependency>
 +
</dependencies>
 +
</source>
  
 
==  Repository ==
 
==  Repository ==
Line 9: Line 23:
 
You would refer to different repositories in your pom.xml depending on whether you are evaluating or you are a premium user.
 
You would refer to different repositories in your pom.xml depending on whether you are evaluating or you are a premium user.
  
1. Evaluating users (60-days free evaluation)
+
=== Evaluating users (60-days free evaluation) ===
  
 
* http://mavensync.zkoss.org/eval
 
* http://mavensync.zkoss.org/eval
Line 22: Line 36:
 
</source>
 
</source>
  
2. Premium users only
+
=== Premium users only ===
  
 
* <span style="color:red">'''Notice'''</span>: Need [[ZK_Pivottable_Essentials/Quick_Start/Using_Maven#Login_authentication|Login authentication]]
 
* <span style="color:red">'''Notice'''</span>: Need [[ZK_Pivottable_Essentials/Quick_Start/Using_Maven#Login_authentication|Login authentication]]
  
: If you are our customer or ZOL licensed user, please contact [mailto:[email protected] [email protected]] to apply for a premium maven account to use ZK Premium Maven Repository.
+
: If you are our customer, please apply for a premium maven account to use ZK Premium Maven Repository.
  
* http://maven.zkoss.org/repo/zk/ee
+
* https://maven.zkoss.org/repo/zk/ee
  
 
<source lang="xml">
 
<source lang="xml">
 
<repositories>
 
<repositories>
 
<repository>
 
<repository>
<id>ZK EE Repository</id>
+
<id>ZK EE</id>
 
<url>https://maven.zkoss.org/repo/zk/ee</url>
 
<url>https://maven.zkoss.org/repo/zk/ee</url>
 
</repository>
 
</repository>
Line 39: Line 53:
 
</source>
 
</source>
  
=== Login authentication ===
+
==== Login authentication ====
  
 
Please refer to the [http://maven.apache.org/settings.html#Servers official documentation] of Apache Maven project for storing login authentication credential in the global settings file.
 
Please refer to the [http://maven.apache.org/settings.html#Servers official documentation] of Apache Maven project for storing login authentication credential in the global settings file.
Line 54: Line 68:
 
<servers>
 
<servers>
 
<server>
 
<server>
<id>ZK EE Repository</id><!-- Same as the repository name used in your pom.xml -->
+
<id>ZK EE</id>
<!-- Please replace the following with your premium username and password -->
+
<!-- Same as the repository name used in your pom.xml -->
 +
<!-- Please replace the following with your  
 +
premium username and password -->
 
<username>premium</username>
 
<username>premium</username>
 
<password>2k0553cr3t</password>
 
<password>2k0553cr3t</password>
Line 63: Line 79:
 
</source>
 
</source>
  
=== Troubleshooting ===
+
==== Sample of pom.xml for licensed ZK Pivottable Package ====
If you were a customer having a premium account and your Maven reported the following error message:
 
 
 
'''sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target'''
 
 
 
Please contact [mailto:[email protected] [email protected]] to request a certificate file and import the certificate using keytool:
 
 
<source lang="xml">
 
<source lang="xml">
keytool –import –noprompt –trustcacerts –alias ALIASNAME -file FILENAME_OF_THE_INSTALLED_CERTIFICATE -keystore PATH_TO_CACERTS_FILE -storepass PASSWORD
+
<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>zkpvt</groupId>
 +
<artifactId>sample</artifactId>
 +
<version>0.0.1-SNAPSHOT</version>
 +
<properties>
 +
<!-- please change the version accordingly -->
 +
<zk.version>6.5.2</zk.version>
 +
<commons-io>1.3.1</commons-io>
 +
<zkpivot.version>2.0.2</zkpivot.version>
 +
<zkpoi.version>3.8.1</zkpoi.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>
 +
<dependency>
 +
<groupId>org.zkoss.zk</groupId>
 +
<artifactId>zkbind</artifactId>
 +
<version>${zk.version}</version>
 +
</dependency>
 +
<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>zhtml</artifactId>
 +
<version>${zk.version}</version>
 +
</dependency>
 +
 +
<dependency>
 +
<groupId>commons-io</groupId>
 +
<artifactId>commons-io</artifactId>
 +
<version>${commons-io}</version>
 +
</dependency>
 +
 +
<!-- ZK Pivottable -->
 +
    <dependency>
 +
        <groupId>org.zkoss.pivot</groupId>
 +
        <artifactId>pivottable</artifactId>
 +
        <version>${zkpivot.version}</version>
 +
    </dependency>
 +
    <!-- Optional: ZK Pivottable dependency (export to excel format) -->
 +
<dependency>
 +
<groupId>org.zkoss.poi</groupId>
 +
<artifactId>zpoiex</artifactId>
 +
<version>${zkpoi.version}</version>
 +
</dependency>
 +
   
 +
</dependencies>
 +
</project>
 
</source>
 
</source>
'''Note''': The initial password of the "cacerts" keystore file is "changeit". Please refer to [http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html here] for detail.
 
 
'''Example:'''
 
  
 +
==== Troubleshooting ====
 +
If you have problem switching from the evaluation repository to the licensed one, please check the followings:
 +
*1 '''Remove evaluation repository''', [http://books.zkoss.org/wiki/ZK_Pivottable_Essentials/Quick_Start/Using_Maven#Repository use ZK EE repository instead]
 +
*2. [http://books.zkoss.org/wiki/ZK_Pivottable_Essentials/Quick_Start/Using_Maven#Login_authentication Login authentication]
 +
*3. [http://books.zkoss.org/wiki/ZK_Pivottable_Essentials/Quick_Start/Using_Maven#Purge_local_repository_evaluation_cache Delete maven local repository evaluation  cache]
 +
===== Purge local repository evaluation cache =====
 +
* 1. Add purge-local-repository plugin in pom.xml
 
<source lang="xml">
 
<source lang="xml">
keytool -import -noprompt -trustcacerts -alias ZKOSS_root_CA -file C:\maven_test\ZKOSS_root_CA.crt -keystore "C:\Program Files\Java\jdk1.6.0_18\jre\lib\security\cacerts" -storepass changeit
+
    <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.pivot:pivottable
 +
                                </manualInclude>
 +
                                <manualInclude>org.zkoss.poi:zpoiex
 +
                                </manualInclude>
 +
                            </manualIncludes>
 +
                        </configuration>
 +
                    </execution>
 +
                </executions>
 +
            </plugin>
 +
        </plugins>
 +
    </build>
 
</source>
 
</source>
  
== Dependency ==
+
*2. Invoke '''maven clean''' to delete local repository evaluation cache
 
 
The dependency setting in your pom.xml stays the same regardless of your user status (evaluating or a premium customer).
 
 
 
 
<source lang="xml">
 
<source lang="xml">
<dependencies>
+
mvn clean
<dependency>
 
<groupId>org.zkoss.pivot</groupId>
 
<artifactId>pivottable</artifactId>
 
<version>2.0.1</version>
 
</dependency>
 
</dependencies>
 
 
</source>
 
</source>
  

Revision as of 08:25, 9 March 2020


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

Dependency

The dependency setting in your pom.xml stays the same regardless of your user status (evaluating or a premium customer).

<dependencies>	
	<dependency>
		<groupId>org.zkoss.pivot</groupId>
		<artifactId>pivottable</artifactId>
		<version>2.5.1</version>
	</dependency>
</dependencies>

Repository

You would refer to different repositories in your pom.xml depending on whether you are evaluating or you are a premium user.

Evaluating users (60-days free evaluation)

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

Premium users only

If you are our customer, please apply for a premium maven account to use ZK Premium Maven Repository.
<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 Pivottable 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>zkpvt</groupId>
	<artifactId>sample</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<properties>
		<!-- please change the version accordingly -->
		<zk.version>6.5.2</zk.version>
		<commons-io>1.3.1</commons-io>
		<zkpivot.version>2.0.2</zkpivot.version>
		<zkpoi.version>3.8.1</zkpoi.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>
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zkbind</artifactId>
			<version>${zk.version}</version>
		</dependency>
		<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>zhtml</artifactId>
			<version>${zk.version}</version>
		</dependency>
		
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>${commons-io}</version>
		</dependency>
		
		<!-- ZK Pivottable -->
	    <dependency>
	        <groupId>org.zkoss.pivot</groupId>
	        <artifactId>pivottable</artifactId>
	        <version>${zkpivot.version}</version>
	    </dependency>
	    <!-- Optional: ZK Pivottable dependency (export to excel format) -->
		<dependency>
			<groupId>org.zkoss.poi</groupId>
			<artifactId>zpoiex</artifactId>
			<version>${zkpoi.version}</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.pivot:pivottable
                                </manualInclude>
                                <manualInclude>org.zkoss.poi:zpoiex
                                </manualInclude>
                            </manualIncludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
  • 2. Invoke maven clean to delete local repository evaluation cache
mvn clean

Version History

Last Update : 2020/03/09


Version Date Content
2.0.0 June 2012 Add Maven information



Last Update : 2020/03/09

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