How to import a module?

2k Views Asked by At

What is the right way to import a module?

I have a main modul called DatabaseGenerator. It's located under eu.the4thfloor.dme.generator.main.DatabaseGenerator.mtl

I have another modul called DatabaseGeneratorHelper. This is located under eu.the4thfloor.dme.generator.common.DatabaseGeneratorHelper.mtl

Now I want to import the helper module with this command:

[import eu::the4thfloor::dme::generator::common::DatabaseGeneratorHelper /]

I get no error in the modul files but I get a error from Eclipse:

Errors occurred during the build.
Errors running builder 'Acceleo Builder' on project 'eu.the4thfloor.dme.generator'.
org.eclipse.core.internal.resources.ResourceException: Resource '/dme.generator/bin/eu/the4thfloor/dme/generator/common/DatabaseGeneratorHelper.emtl' does not exist.

But the files exist. Whats going wrong?

And is it right that the helper modul does not have xml files in the task folder?

Ralph

2

There are 2 best solutions below

7
On

Have you tried running "Project clean" in Eclipse?

Make sure you have your .mtl in the package: eu.the4thfloor.dme.generator.common

If so, I would try...

  • Delete DatabaseGeneratorHelper.java
  • F5 in the root project.
  • Project clean.
  • Make a change in the .mtl (for example, white space) and save the file.
  • Run acceleo with your ordinary config.

Sometimes, Acceleo makes strange things because of errors in compiled files... but after this sequence everything usually works perfect.

PS: I would like to post a comment but I haven't got enought points

0
On

Definitely I think I solved the problem.

Acceleo requires that the name of your project in your workspace (i.e., the one you can see in the Package Explorer in the left tab in Eclipse) needs to be EXACTLY THE SAME as the name of the folder containing the project in your file system.

It seems that Acceleo compiler uses the name in the workspace instead the real containing folder's name during compilation, which may be a bug of the compiler since Acceleo projects with a different name are not allowed.