2017-04-17 18 views
0

우선, 저는 Acceleo와 Eclipse의 모델링 기능을 처음 접했습니다. 내가 뭘하려고하는지 간단하게 테스트 파일을 만드는 것입니다. 나는 이것이 내가 얻을 실행하면Acceleo : 세대가 파일을 생성하지 못했습니다.

comment encoding = UTF-8 /] 
[module generate('file:/C:/Users/maria/Documents/workspace/org.eclipse.acceleo.module.m2tTransformation/model/PSMMetamodel.ecore')] 

[template public generateElement(aServicePSM : ServicePSM)] 
[comment @main/] 
[file ('test.java', false, 'UTF-8')] 
Test 
[/file] 
[/template] 

: 내가 사용하는

The generation failed to generate any file because there are no model elements that matches at least the type of the first parameter of one of your main templates. 
The problem may be caused by a problem with the registration of your metamodel, please see the method named "registerPackages" in the Java launcher of your generator. It could also come from a missing [comment @main/] in the template used as the entry point of the generation. 

또한 URI가 nsURI 내가 메타 모델의 루트로 설정 값을 속성입니다 스타터 그래서, 나는 메인 모듈을 만들었습니다. 내 입력 모델에 ServicePSM 요소가 포함되어있을 것으로 확신합니다. 내가 뭘 잘못 했니?

미리 감사드립니다.

답변

0

이 문제는 나는 우리를 생각하는 당신은 메타 모델은 메시지에서

를 해결할 수없는

  • 모델에 올바른 유형의 요소가없는 이가지 경우

    1. 에서 발생합니다 안전하게 무시할 수 있습니다. 1. 모델에 ServicePSM이 하나 이상있는 것으로 보이므로 2를 처리해야합니다.

      모듈을 보면 선언 한 것입니다 메타 모델 file:/C:/Users/maria/Documents/workspace/org.eclipse.acceleo.module.m2tTransformation/model/PSMMetamodel.ecore에서 생성합니다. 그러나 EMF는 이러한 종류의 URI를 사용하여 메타 모델을 참조하는 경우는 거의 없습니다. 텍스트 편집기 (오른쪽 클릭> 연결 프로그램> 텍스트 편집기)로 실제 모델을 여는 경우 처음에는 "xmlns"태그를 사용하여 메타 모델을 참조하는 데 실제로 사용 된 URI를 볼 수 있습니다.

      예를 들어, OCL 요소를 참조하는 모델을 열면 xmlns:ocl.ecore="http://www.eclipse.org/ocl/1.1.0/Ecore"이 표시됩니다. EMF가 모델 파일에서 사용하는 것과 같은 URI를 모듈 파일에 사용했는지 확인해야합니다.이 경우에는 http://www.eclipse.org/ocl/1.1.0/Ecore이됩니다.