English 中文(简体)
Hazelcast - Setup
  • 时间:2024-12-27

Hazelcast - Setup


Previous Page Next Page  

Hazelcast Java 1.6或以上。 Hazelcast还可使用NET、C++或Schala和Clojure等其他基于证书的语文。 然而,对这一理论,我们将使用 Java8。

在我们开始之前,下面是我们将用于这一辅导的项目。


hazelcast/
├── com.example.demo/
│ ├── SingleInstanceHazelcastExample.java
│ ├── MultiInstanceHazelcastExample.java
│ ├── Server.java
│ └── ....
├── pom.xml
├── target/
├── hazelcast.xml
├── hazelcast-multicast.xml
├── ...

For now, we can just create the package, i.e., com.example.demo inside the hazelcast directory. Then, just cd to that directory. We will look at other files in the upcoming sections.

Instalpng Hazelcast

停泊的Hazeelcast只是把JAR的档案添加到你的建筑档案中。 POM 档案或建筑。 根据您是否分别使用Maven或Gradle的梯度。

如果你使用格拉斯,则增加如下内容: 梯度档案足够——


dependencies {
   compile "com.hazelcast:hazelcast:3.12.12”
}

POM for the tutorial

我们将利用以下管理局进行我们的辅导:


<?xml version="1.0" encoding="UTF-8"?>
<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>1.0.0</modelVersion>
   <groupId>com.example</groupId>
   <artifactId>demo</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>demo</name>
   <description>Demo project for Hazelcast</description>

   <properties>
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
   </properties>

   <dependencies>
      <dependency>
         <groupId>com.hazelcast</groupId>
         <artifactId>hazelcast</artifactId>
         <version>3.12.12</version>
      </dependency>
   </dependencies>

   <!-- Below build plugin is not needed for Hazelcast, it is being used only to created a shaded JAR so that -->
   <!-- using the output i.e. the JAR becomes simple for testing snippets in the tutorial-->
   <build>
      <plugins>
         <plugin>
            <!-- Create a shaded JAR and specify the entry point class-->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
               <execution>
                  <phase>package</phase>
                     <goals>
                     <goal>shade</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
</project>
Advertisements