创建和设置 Maven 项目
创建一个名为“ActivitiDeveloperQuickStart”的 Java 项目(以下称为$quickStartJavaProjectName
),其中包含以下 Maven 依赖项:
文件:$mvnProject/pom.xml
<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>$quickStartJavaProjectName</groupId>
<artifactId>$quickStartJavaProjectName</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- ... other configurations may exist, such as a build stanza, depending your environment ... -->
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>$actVer</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
</dependency>
</dependencies>
</project>
当然,$actVer
将替换为下载的 Activiti 版本,例如,如果你下载的 Activiti 软件包是“activiti-5.22.0”,那么 $actVer
的值将是 5.22.0。
请注意以下依赖项:
- Activiti(
org.activiti
)— Activiti 的 BPM 引擎 - 数据库(
com.h2database
)— H2 数据库 - 日志记录(
org.slf4j
)— Java 的简单日志外观
在引用构建目录时,本教程假定你的 maven 项目的标准 Maven 构建路径:
路径 | 描述 |
---|---|
$mvnProject /src/main/java |
Java 源目录 |
$mvnProject /src/main/resources |
Resource 目录 |
$mvnProject /src/test/java |
Java 测试目录 |
$mvnProject /src/test/resources |
Resource 测试目录 |
你应该能够构建空白项目,在继续之前,请确保整体状态为“BUILD SUCCESS”。
命令:mvn compile
基础路径:$mvnProject
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building $quickStartJavaProjectName 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ $quickStartJavaProjectName ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ HelloProcess2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.592s
[INFO] Finished at: Sun Nov 27 05:09:59 EST 2016
[INFO] Final Memory: 10M/309M
[INFO] ------------------------------------------------------------------------
你的输出可能看起来不同,最值得注意的是,maven 可能需要检索项目依赖项。