1 new MAVEN Project
2 Modify the Pom file, the complete content is as follows
<?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>4.0.0</modelVersion> <groupId>com.huitong</groupId> <artifactId>actdemo1</artifactId> <version>0.0.1-snapshot</version> <name>actdemo1</name> <!--fixme it to the project's website --<url>http://www.example.com</url><properties> <project.build.sourceencoding>utf-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <activiti.version>6.0.0</activiti.version> </properties> <dependencies> <dependency> <groupid>junit</g Roupid> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <GROUPID&G T;org.activiti</groupid> <artifactId>activiti-engine</artifactId> <version>${activiti. version}</version> </dependency> <dependency> <groupid>org.activiti</groupid> ; <artifactId>activiti-spring</artifactId> <version>${activiti.version}</version> </DEP endency> <dependency> <groupId>org.slf4j</groupId> <artifactid>slf4j-api</a Rtifactid> <version>1.7. +</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artif Actid>slf4j-log4j12</artifactid> <version>1.7. +</version> </dependency> <!--https://Mvnrepository.com/artifact/mysql/mysql-connector-java --<dependency> <groupId>mysql</groupId> <artifactid>mysql-connector-java</artifacti D> <version>5.1. $</version> </dependency> <!--https://Mvnrepository.com/artifact/joda-time/joda-time --<dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.8.2</version> </dependency> </dependencies> <build> <pluginManagement><!--LockDown plugins versions to avoidusingMaven defaults (moved to parent POM)-<plugins> <plugin> <artifactid>m Aven-clean-plugin</artifactid> <version>3.0.0</version> </plugin> <!--see http://maven.apache.org/ref/current/maven-core/default-bindings.html#plugin_bindings_for_jar_packaging --<plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <ARTIFACTID>MAVEN-COMPILER-PLUGIN</ARTIFAC Tid> <version>3.7.0</version> </plugin> <plugin> <ARTIFACTID>MAVEN-SUREFIRE-PLUGIN</ARTIFAC Tid> <version>2.20.1</version> </plugin> <plugin> <ARTIFACTID>MAVEN-JAR-PLUGIN</ARTIFACTID&G T <version>3.0.2</version> </plugin> <plugin> <artifactid>maven-install-plugin</artifact Id> <version>2.5.2</version> </plugin> <plugin> <artifactid>maven-deploy-plugin</artifacti D> <version>2.8.2</version> </plugin> </plugins> </pluginManagement> </build></project>
3 Add profile Activiti.cfg.xml under the Resources folder, mainly configure a processengineconfiguration
<beans xmlns="Http://www.springframework.org/schema/beans"Xmlns:context="Http://www.springframework.org/schema/context"xmlns:tx="Http://www.springframework.org/schema/tx"Xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation="Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http//Www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-2.5.xsdhttp//Www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-3.0.xsd"><bean id="processengineconfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"> <property name="Jdbcdriver"Value="Com.mysql.jdbc.Driver"/> <property name="Jdbcurl"Value="Jdbc:mysql://localhost:3306/activiti?characterencoding=utf8"/> <property name="Jdbcusername"Value="Root"/> <property name="Jdbcpassword"Value="root123"/> <property name="databaseschemaupdate"Value="true"/> </bean></beans>
4 Configuring the log4j configuration file log4j.properties
Log4j.rootlogger=DEBUG, ACTlog4j.appender.ACT= Org.apache.log4j.ConsoleAppenderlog4j.appender.ACT.layout= Org.apache.log4j.PatternLayoutlog4j.appender.ACT.layout.ConversionPattern=%d{hh:mm:ss,sss} [%t]%-5p%c%x-%m %n
5 Adding a class, App.java
Package Com.huitong.actdemo1;import Org.activiti.engine.processengine;import Org.activiti.engine.processengines;import Org.activiti.engine.repositoryservice;import Org.activiti.engine.runtimeservice;import Org.activiti.engine.TaskService;/** * Hello world! **/ Public classApp { Public Static voidMain (string[] args) {processengine pengine=Processengines.getdefaultprocessengine (); Repositoryservice Repservice=Pengine.getrepositoryservice (); Runtimeservice Runservice=Pengine.getruntimeservice (); Taskservice Taskservice=Pengine.gettaskservice (); Pengine.close (); System. out. println ("it's over."); }}
6 after running, you will find many more tables in the database Activiti, a total of 28
Eclipse Create Activiti6 Project Demo