Home » Modeling » M2T (model-to-text transformation) » [Acceleo/MoDisco] Problem generating Java source code
[Acceleo/MoDisco] Problem generating Java source code [message #528009] |
Sun, 18 April 2010 13:31  |
Eclipse User |
|
|
|
Dear all,
I am having a problem generating java source code from java models using MoDisco (similar but not identical to the problem of Timothy Marc).
I am running a Junit4 PLUGIN test case to create a java model and to write it out as java code.
First: Creating the model works nicely, and it is serialised just fine (I can open the resulting file "x.javaxmi" in Eclipse with the MoDisco Model Browser):
Model model = JavaFactory.eINSTANCE.createModel();
ResourceSet resourceSet = new ResourceSetImpl();
URI fileURI = URI.createFileURI("x.javaxmi");
XMIResource xmlResource = (XMIResource) resourceSet
.createResource(fileURI);
xmlResource.getContents().add(model);
xmlResource.save(null);
The problem arises when I try to generate code with the following fragment:
Generate_JavaStructures s = new Generate_JavaStructures(model,
new File("."), new ArrayList<Object>());
s.doGenerate(new BasicMonitor());
I get the error message
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http://www.eclipse.org/acceleo/mtl/0.8.0' not found.
I have installed a plain helios m6 to test this (I understood that I need helios, correct?) I have used the following packages, nothing else is installed;
I installed eclipse-modeling-helios-M6-incubation-win32.zip, afterwards, via downloaded JAR update sites and the "Install New Software", the following (all these were required to allow me to finally install "MODISCO-Update-0.8.0M6"
- m2t-jet-Update-1.1.0M6
- m2m-atl-Update-3.1.0M6
- mdt-ocl-Update-3.0.0M6
- m2t-acceleo-Update-incubation-3.0.0M6
- MODISCO-Update-0.8.0M6
Please let me know how to correct this problem, and whether there is an easier way of installing all of this - I am probably doing something horribly wrong 
(By the way, another question would by why I need to serialize the model first - the generation seems to require an attached resource set. Is there another way?).
Thanks a lot!
Philip
[Updated on: Mon, 19 April 2010 02:35] by Moderator
|
|
|
Re: [Acceleo/MoDisco] Problem generating Java source code [message #528132 is a reply to message #528009] |
Mon, 19 April 2010 09:19   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------060007020206010203060905
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Philip,
I'd say yours is the "easy" problem I told Timothy Marc about at the
very beginning of his thread (and which wasn't the issue for him :p).
First of all, Helios is not required for Acceleo 3.0. We're compatible
with Eclipse 3.4, Eclipse 3.5 and Eclipse 3.6. The changes that can
arise are behavioral changes in the OCL parsing : an Acceleo module that
parses well in 3.6 (with OCL 3.0) may not parse in Eclipse 3.4 (with OCL
1.2). However a module that can be parsed in 3.4 will parser in 3.6. The
runtime is fully compatible as far as my tests have gone : a template
parsed in 3.6, 3.5 or 3.4 can be evaluated in all three seamlessly.
That aside, what you have here is that you compiled a module (mtl file)
with Acceleo previous to 3.0M6 (thus creating an emtl file) ; yet you
try to load and evaluate this compiled emtl with Acceleo 3.0M6. The
issue is : we changed the Acceleo metamodels' URIs for M6. What was
"http://www.eclipse.org/acceleo/mtl/0.8.0" before is now
"http://www.eclipse.org/acceleo/mtl/3.0".
Recompile your generation modules with your current Acceleo (3.0M6) and
you shouldn't see this problem again.
Laurent Goubet
Obeo
P.S: if you are not responsible for the module files
("generate_javastucture.mtl"), but try to run the generation from your
code anyway, you'll have to switch back to the Acceleo version the
module manager uses, in this case, anything previous to 3.0M6.
Philip Mayer wrote:
> Dear all,
>
> I am having a problem generating java source code from java models using
> MoDisco (similar but not identical to the problem of Timothy Marc).
>
> I am running a Junit4 PLUGIN test case to create a java modeland to
> serialise it.
> First: Creating the model works nicely, and it is serialised just fine
> (I can open the resulting file "x.javaxmi" in Eclipse with the MoDisco
> Model Browser):
>
>
> Model model = JavaFactory.eINSTANCE.createModel();
> ResourceSet resourceSet = new ResourceSetImpl();
> URI fileURI = URI.createFileURI("x.javaxmi");
>
> XMIResource xmlResource = (XMIResource) resourceSet
> .createResource(fileURI);
> xmlResource.getContents().add(model);
> xmlResource.save(null);
>
>
> The problem arises when I try to generate code with the following fragment:
>
>
> Generate_JavaStructures s = new Generate_JavaStructures(model,
> new File("."), new ArrayList<Object>());
> s.doGenerate(new BasicMonitor());
>
>
> I get the error message
>
>
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
> uri 'http://www.eclipse.org/acceleo/mtl/0.8.0' not found.
>
> I have installed a plain helios m6 to test this (I understood that I
> need helios, correct?) I have used the following packages, nothing else
> is installed;
>
> I installed eclipse-modeling-helios-M6-incubation-win32.zip, afterwards,
> via downloaded JAR update sites and the "Install New Software", the
> following (all these were required to allow me to finally install
> "MODISCO-Update-0.8.0M6"
>
>
> m2t-jet-Update-1.1.0M6
> m2m-atl-Update-3.1.0M6
> mdt-ocl-Update-3.0.0M6
> m2t-acceleo-Update-incubation-3.0.0M6
> MODISCO-Update-0.8.0M6
>
>
> Please let me know how to correct this problem, and whether there is an
> easier way of installing all of this - I am probably doing something
> horribly wrong ;)
>
> Thanks a lot!
>
> Philip
>
--------------060007020206010203060905
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------060007020206010203060905--
|
|
| |
Re: [Acceleo/MoDisco] Problem generating Java source code [message #528329 is a reply to message #528196] |
Tue, 20 April 2010 03:54   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------030005040201010405030009
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Philip,
Ok, much I didn't understand in your first post, notably the relation
with modisco. In short : you need to install an earlier version of
Acceleo to use the generators bundled with modisco. Easiest way to do
this is to go to
http://www.eclipse.org/modeling/m2t/downloads/?project=accel eo and
download the all in one update site for the 0.9.0M5 version (which is
the build previous to 3.0.0M6). This particular update site is on
http://www.eclipse.org/modeling/download.php?file=/modeling/ m2t/acceleo/downloads/drops/0.9.0/S201002020636/m2t-acceleo- Update-incubation-0.9.0M5.zip
..
For a longer explanation, see my comments inlined below :p.
Laurent Goubet
Obeo
Philip Mayer wrote:
> Dear Laurent,
>
> first of all, thanks for your answer. I believe, however, that my
> problem is more with MoDisco than with Acceleo.
> What I am trying to do is invoke the modisco java code generator, as
> described on the website
> http://wiki.eclipse.org/MoDisco/Components/Java/Documentatio n/0.8#Java_Generation
> So let's go away from my initial code and to just invoking this code
> generation.
>
>> P.S: if you are not responsible for the module files
>> ("generate_javastucture.mtl"),
>
> You are correct, I am not. I am simply trying to use this file, which is
> provided in the "org.eclipse.gmt.modisco.java.generation" plugin, to
> generate java code. As far as I understand the picture, the code
> generation is a modisco feature, but it requires acceleo to run (and
> herein lies the problem).
Yup, and they used Acceleo 0.8.* or 0.9.* to compile their generator,
which is why you cannot launch the generation with Acceleo 3.0 (see my
previous mail).
>
> Now, the MoDisco website (http://wiki.eclipse.org/MoDisco/Components)
> states that the full java metamodel and the code generation is only
> available in "MoDisco 0.8". The same page also says that "MoDisco 0.8"
> is for helios.
> So I assumed that I need Helios. I actually tried checking out the
> modisco plugins from SVN in a galileo eclipse instance, too, but there
> were lots of compile errors (for example, the class import
> org.eclipse.acceleo.engine.generation.strategy.DefaultStrate gy is not
> found in the Generate_JavaStructure.java file). So I assume that it
> indeed does not work in Galileo.
True, my comment on us being compatible with Ganymede, Galileo and
Helios was only related to Acceleo ; maintaining compatibility with
different versions of Eclipse is not mandatory and other projects (such
as MoDisco) may not do it.
>
> I thus installed everything in Helios M6 + Acceleo 3.0.0 + the milestone
> modisco update site
> ( http://download.eclipse.org/modeling/gmt/modisco/updates/mil estones/).
> Now, the website
> http://wiki.eclipse.org/MoDisco/Components/Java/Documentatio n/0.8#Java_Generation
> states two methods of invoking the code generator:
>
> a) use the import plugin wizard for the java.generation package and run
> an Acceleo launch configuration for the Generate_JavaStructures class.
> When I do this, I get (in the error log)
>
>
> ERROR: Couldn't load class
> org.eclipse.gmt.modisco.java.generation.files.Generate_JavaS tructures
> from project org.eclipse.gmt.modisco.java.generation
>
> WARN:
> org.eclipse.osgi.framework.internal.core.Framework$Duplicate BundleException:
> Bundle "org.eclipse.gmt.modisco.java.generation" version
> "0.8.0.v201003161136" has already been installed from:
> reference:file:plugins/org.eclipse.gmt.modisco.java.generati on_0.8.0.v201003161136.jar
>
The warning and error are not related, the warning being an information
that we keep for debugging purposes (it'll be removed from the Helios
release, we're mostly done with the underlying problem's correction).
And the error indicating a classpath issue ... yet indeed the issue
seems to lie in having a generator project in both workspace and
installed plugins.
>
>
> b) again, use the import plugin wizard for the java.generation package ,
> but launch the main class not with a Acceleo launch config but as
> standard java app (this should be equivalent to launching it from my own
> plugin) This yields:
>
>
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
> uri 'http://www.eclipse.org/acceleo/mtl/0.8.0' not found.
>
And we're back at the initial issue : MoDisco compiles its Acceleo
generator with a version prior to 3.0M6, and you try to load it with
this version. Uninstall 3.0M6 and switch back to anything previous to
it, and the issue shall be gone.
>
>
> So, in a) I seem to not be allowed to have a copy of the .generation
> project in the workspace and somehow it cannot find the class, and in
> b), the acceleo version does not match, because the
> generate_javastructure.emtl which is provided in "MoDisco 0.8" in the
> "org.eclipse.gmt.modisco.java.generation" plugin carries the namespace
> "http://www.eclipse.org/acceleo/mtl/0.8.0", but the Acceleo version
> installed in Helios is actually 3.0.0.
>
> I sadly do not know how to proceed. Can you point out to me how to set
> up an Eclipse installation in which I can use the MoDisco java model
> generator? What is the preferred way of doing this?
>
>
> Thanks,
>
> Philip
--------------030005040201010405030009
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030005040201010405030009--
|
|
| | | | | | |
Goto Forum:
Current Time: Thu Jul 10 23:32:44 EDT 2025
Powered by FUDForum. Page generated in 0.06515 seconds
|