I guess I'm a bit confused about the issue you're having then. Between having the package statement "package dot.grammar" and having your source code in a "dot/grammar" folder structure, your classes should be in the package. Do you actually have folders named "dot.grammar" ? But basically, whatever directory you want the output source to be in (underneath "target/generated-sources/antlr"), put it in that directory underneath "src/main/antlr".
If this doesn't help, maybe you could zip up a project and send it to me? I'm pretty sure I do what you're trying to do fairly often and I haven't had any trouble with it. -Jared On Wed, Dec 3, 2008 at 10:36 PM, Ashok Varikuti <[EMAIL PROTECTED]> wrote: > Jared Bunting wrote: > >> Not sure how your files are setup, but if I recall correctly, the maven >> plugin places the output files in folders based on where your input files >> are. So, place your dot.g file in src/main/antlr/dot/grammar (just like you >> would *.java files in a package) - then the output should end up in >> target/generated-sources/antlr/dot/grammar. Also, I would check to be sure >> you are using the new version of the maven plugin (3.1.1.1 < >> http://3.1.1.1>) - I believe I recall that version 3.1.1 had some >> consistency issues with output directories. >> >> -Jared >> >> >> On Wed, Dec 3, 2008 at 9:29 PM, Ashok Varikuti <[EMAIL PROTECTED]<mailto: >> [EMAIL PROTECTED]>> wrote: >> >> Ashok Varikuti wrote: >> > Hi List, >> > >> > I encapsulated antlr grammar files in a eclipse maven project. The >> > compilation task of grammar files is done at maven compile time. I >> > specified the output directory to be the following :- >> > >> > * target/generated-sources/antlr >> > * dot.grammar >> > o dot.tokens >> > o dotlexer.java >> > o dotparser.java >> > >> > where *dot.grammar* is the package name I specified in the >> dot.g file >> > @header { >> > package prefuse.parser.dotparser; >> > } >> > @lexer::header { >> > package prefuse.parser.dotparser; >> > } >> > >> > But when I did a maven compile, the generated files are >> generated in >> > the output folder but with no package name. >> > >> > * target/generated-sources/antlr o dot.tokens >> > o dotlexer.java >> > o dotparser.java >> > >> > The geenrated files are not part of any package anymore. Can >> anyone >> > help me with this. All the configuration instructions in a maven >> > project are specified in a pom.xml file. >> > >> > >> > >> Sorry substitute the package name as below:- >> >> @header { >> package dot.grammar; >> } >> @lexer::header { >> package dot.grammar; >> } >> >> -- >> Ashok R Varikuti >> Graduate Research Assistant >> CIS Dept, Kansas State University >> 785-304-2401 >> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >> >> >> >> List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest >> Unsubscribe: >> >> http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address >> >> >> Hi Jared, > > Thank you for the answer. You are right on target when u said that the > *output should end up in target/generated-sources/antlr/dot/grammar.* But I > needed the output files to be part of package rather. For now this is how > its generated:- > > * target/generated-sources/antlr/dot/grammar > o (default package) > + dot.tokens > + dotparser.java > + dotlexer.java > > I want the structure to be something like this :- > * target/generated-sources/antlr > o dot.grammar > + dot.tokens > + dotparser.java > + dotlexer.java > > > * src/main/java > o dot.util.grammar > + dotOp.java --> here I need to use dotparser.java, > which is not possible when --> the file is generated > in a default package. > > > > As you can observe, the main difference being the output files are part of > package "dot.grammar" as I mentioned in the grammar file. When the files are > generated are generated in a default package, I have no way to import them > and use elsewhere since I can't refer to them and they aren't even part of a > source folder either. I need to import the java > files(dotparser.java,dotlexer.java) into my packages in src/main/java. > > -- > Ashok R Varikuti > Graduate Research Assistant > CIS Dept, Kansas State University > 785-304-2401 > [EMAIL PROTECTED] > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
