2016-08-03 44 views
0

Ich versuche, eine einfache Hello World-Anwendung mit Activiti Eclipse BPMN Designer 5.9 machen. Ich habe ein activiti-Projekt in Eclipse erstellt und das Diagramm check.bpmn zum Ordner src/main/resources und meine Dateien .java zu src/test/java und activiti.cfg.xml zum Ordner src/test/resources hinzugefügt. Die Anwendung soll nur die Warnung "Hello" auf der Konsole anzeigen, aber ich kann es anscheinend nicht dazu bringen. Unten, wenn alle Dateien, die ich verwende, um die Anwendung auszuführen. Ich weiß nicht, was ich vermisse. Ich habe Activiti Eclipse BPMN 2.0 Designer installiert.BPMN Fehler in Eclipse activiti

UPDATE:

ich habe hinzugefügt JAR-Dateien enter image description here

Fehler:

enter image description here 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/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>org.activiti.examples</groupId> 
    <artifactId>activiti-examples</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>jar</packaging> 
    <name>BPMN 2.0 with Activiti - Examples</name> 
    <properties> 
    <activiti-version>5.8</activiti-version> 
    </properties> 
    <dependencies> 
    <dependency> 
     <groupId>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> 
    </dependency> 
    <dependency> 
     <groupId>org.codehaus.groovy</groupId> 
     <artifactId>groovy</artifactId> 
     <version>1.7.5</version> 
    </dependency> 
    <dependency> 
     <groupId>com.h2database</groupId> 
     <artifactId>h2</artifactId> 
     <version>1.2.132</version> 
    </dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.8.1</version> 
    </dependency> 
    </dependencies> 
    <repositories> 
    <repository> 
     <id>Activiti</id> 
     <url>http://maven.alfresco.com/nexus/content/repositories/activiti</url> 
     </repository> 
    </repositories> 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.2</version> 
     <configuration> 
      <source>1.6</source> 
      <target>1.6</target> 
      </configuration> 
     </plugin> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-eclipse-plugin</artifactId> 
     <inherited>true</inherited> 
     <configuration> 
      <classpathContainers> 
       <classpathContainer>org.eclipse.jdt.USER_LIBRARY/Activiti Designer Extensions</classpathContainer> 
      </classpathContainers> 
      </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

Check.bpmn:

<?xml version="1.0" encoding="UTF-8"?> 
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"> 
    <process id="process1" name="process1"> 
    <startEvent id="startevent1" name="Start"></startEvent> 
    <scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript"> 
     <script><![CDATA[alert("hello");]]></script> 
    </scriptTask> 
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="scripttask1"></sequenceFlow> 
    <endEvent id="endevent1" name="End"></endEvent> 
    <sequenceFlow id="flow2" name="" sourceRef="scripttask1" targetRef="endevent1"></sequenceFlow> 
    </process> 
    <bpmndi:BPMNDiagram id="BPMNDiagram_process1"> 
    <bpmndi:BPMNPlane bpmnElement="process1" id="BPMNPlane_process1"> 
     <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1"> 
     <omgdc:Bounds height="35" width="35" x="200" y="160"></omgdc:Bounds> 
     </bpmndi:BPMNShape> 
     <bpmndi:BPMNShape bpmnElement="scripttask1" id="BPMNShape_scripttask1"> 
     <omgdc:Bounds height="55" width="105" x="280" y="150"></omgdc:Bounds> 
     </bpmndi:BPMNShape> 
     <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1"> 
     <omgdc:Bounds height="35" width="35" x="440" y="160"></omgdc:Bounds> 
     </bpmndi:BPMNShape> 
     <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> 
     <omgdi:waypoint x="235" y="177"></omgdi:waypoint> 
     <omgdi:waypoint x="280" y="177"></omgdi:waypoint> 
     </bpmndi:BPMNEdge> 
     <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"> 
     <omgdi:waypoint x="385" y="177"></omgdi:waypoint> 
     <omgdi:waypoint x="440" y="177"></omgdi:waypoint> 
     </bpmndi:BPMNEdge> 
    </bpmndi:BPMNPlane> 
    </bpmndi:BPMNDiagram> 
</definitions> 

ProcessTestProcess1.java

package org.activiti.designer.test; 

import static org.junit.Assert.*; 

import java.util.HashMap; 
import java.util.Map; 
import java.io.FileInputStream; 

import org.activiti.engine.RepositoryService; 
import org.activiti.engine.RuntimeService; 
import org.activiti.engine.runtime.ProcessInstance; 
import org.activiti.engine.test.ActivitiRule; 
import org.junit.Rule; 
import org.junit.Test; 

public class ProcessTestProcess1 { 

    private String filename = "C:\Users\User\workspace\Proj\src\main\resources\diagrams\Check.bpmn"; 

    @Rule 
    public ActivitiRule activitiRule = new ActivitiRule(); 

    @Test 
    public void startProcess() throws Exception { 
     RepositoryService repositoryService = activitiRule.getRepositoryService(); 
     repositoryService.createDeployment().addInputStream("process1.bpmn20.xml", 
       new FileInputStream(filename)).deploy(); 
     RuntimeService runtimeService = activitiRule.getRuntimeService(); 
     Map<String, Object> variableMap = new HashMap<String, Object>(); 
     variableMap.put("name", "Activiti"); 
     ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process1", variableMap); 
     assertNotNull(processInstance.getId()); 
     System.out.println("id " + processInstance.getId() + " " 
       + processInstance.getProcessDefinitionId()); 
    } 
} 

Fehler:

Description Resource Path Location Type 
The import org.activiti.engine cannot be resolved ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 9 Java Problem 
The import org.activiti.engine cannot be resolved ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 10 Java Problem 
The import org.activiti.engine cannot be resolved ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 11 Java Problem 
The import org.activiti.engine cannot be resolved ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 12 Java Problem 
The import org.activiti cannot be resolved Main.java /helloworld/src/main/java line 1 Java Problem 
The import org.activiti cannot be resolved Main.java /helloworld/src/main/java line 2 Java Problem 
The import org.activiti cannot be resolved Main.java /helloworld/src/main/java line 3 Java Problem 
RuntimeService cannot be resolved to a type ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 28 Java Problem 
RepositoryService cannot be resolved to a type ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 25 Java Problem 
ProcessService cannot be resolved to a type Main.java /helloworld/src/main/java line 13 Java Problem 
ProcessInstance cannot be resolved to a type ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 31 Java Problem 
ProcessEngine cannot be resolved to a type Main.java /helloworld/src/main/java line 10 Java Problem 
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\) ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 18 Java Problem 
DbProcessEngineBuilder cannot be resolved to a type Main.java /helloworld/src/main/java line 10 Java Problem 
ActivitiRule cannot be resolved to a type ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 21 Java Problem 
ActivitiRule cannot be resolved to a type ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 21 Java Problem 
ActivitiRule cannot be resolved to a type ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 25 Java Problem 
ActivitiRule cannot be resolved to a type ProcessTestProcess1.java /Proj/src/test/java/org/activiti/designer/test line 28 Java Problem 
+0

http://codecramp.com/activiti-setup-eclipse/ – EMM

Antwort

2

Der Fehler

Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \)

sagt Ihnen Ihr String ungültig ist.

private String filename = "C:\Users\User\workspace\Proj\src\main\resources\diagrams\Check.bpmn"; 

sollte

private String filename = "C:\\Users\\User etc..."; 
+0

hanks für die Antwort ... wie Importfehler zu beheben ... – nagi

0

prüfen Maven Abhängigkeiten in Ihnen Projektstruktur entwertet werden. Überprüfen Sie, ob activiti-engine-{activiti-version}.jar verfügbar ist oder nicht.

+0

ich diese Gläser enthalten müssen auch ??? Ist das Activity Engine Glas? – nagi

+0

Sie haben diese bereits zu Ihrer POM.xml-Prüfung hinzugefügt, wenn diese geladen werden oder nicht. Wenn nicht, aktualisieren Sie Ihre Maven-Abhängigkeiten, indem Sie mit der rechten Maustaste auf Ihr Projekt> maven> Projekt aktualisieren ... klicken, wählen Sie Ihr Projekt und klicken Sie auf OK. –

+0

gibt es kein Projekt> maven> update Projektoption in Eclipse ... Entschuldigung, ich bin neu zu Maven und activiti so freundlich führe mich, was soll ich tun. ?? – nagi

1

Sie müssen das Projekt in Maven-Projekt konvertieren. Danach sehen Sie "Maven Dependencies" in Ihrem Projekt- und Klassenpfad.

Um zu konvertieren versuchen Sie rechts auf Projektname -> Kontextmenü -> Konfigurieren -> In Maven-Projekt konvertieren.

enter image description here

enter image description here