Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow do I set the package for my generated Java files?
https://www.eclipse.org/forums/index.php/mv/msg/579316/1168050/#msg_1168050
I want my generated Java files to be part of this package:
package com.holycityaudio.SpinCAD.CADBlocks;
(which code is inserted into the Java source file).
However they are being generated in the /SpinCADBuilder/src-gen/(default package) package.
What do I need to do?
Thanks,
GW]]>Gary Worsham2013-11-03T03:17:04-00:00Re: How do I set the package for my generated Java files?
https://www.eclipse.org/forums/index.php/mv/msg/579316/1168405/#msg_1168405
it is actually derived from the grammar name
grammar org.xtext.example.mydsl2.MyDsl
leads to package
org.xtext.example.mydsl2]]>Christian Dietrich2013-11-03T09:09:32-00:00Re: How do I set the package for my generated Java files?
https://www.eclipse.org/forums/index.php/mv/msg/579316/1168767/#msg_1168767
In my 1st instance of Eclipse, all the generated code that parses the grammar is located in packages that I defined in my grammar file. That part of it is fine.
Now I launch my second instance of Eclipse, and I created some new files of the type which my grammar is supposed to parse. When I save one of these files, the translated version (a Java file) is created. How do I set the package where THAT file gets created?
As it stands now, I am keeping my Xtext grammar and Xtend code generator (Eclipse instance #1) in a different package/path than the source code for my actual Java application (Eclipse instance #2). The application uses a combination of hand written Java code and the classes which are generated using my grammar.]]>Gary Worsham2013-11-03T14:57:58-00:00Re: How do I set the package for my generated Java files?
https://www.eclipse.org/forums/index.php/mv/msg/579316/1168821/#msg_1168821
do you mean the stuff you generate in your IGenerator or Inferred by JvmModelInferrer?
in both cases your are the one to blame. if you do not give the file a path (IGenerator)
or a QualifiedName (Inferrer) you may not complain if there is no package]]>Christian Dietrich2013-11-03T15:48:01-00:00Re: How do I set the package for my generated Java files?
https://www.eclipse.org/forums/index.php/mv/msg/579316/1168827/#msg_1168827
Anyway it is the IGenerator. So I guess what I have to do is determine the path (with slashes) of the desired package and then prepend that to the name of the desired generated file. What I had done previously was to use a "fully qualified name" prefix (with dots) and it simply added that to the file name of each generated file, but still put them in the (default package).