Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Re : Re: m2e, code generation and the Eclipse project builders order

Hi!
Automatic build desactivation for workspace is indeed the cause of my
problem (I always disable it).
I'l have to change some of my coding habbits ;-))
Thanks for your answer!

> Eclipse is expected to detect generated sources and run second
> incremental build automatically. Do you have workspace autobiuld enabled?
>
>
> --
> Regards,
> Igor
>
>
> On 12-04-26 5:35 AM, Eric Cassam-chenaï wrote:
>
> > Hello!
> > I am using m2e managed projects with the maven antlr3 plugin. I have
> > also the Antlr3 configurator installed to manage lifecycle mappings.
> > As the Antlr3 plugin generates source code for parsers, I plug its main
> > goal 'antlr' to the 'generate-sources' phase :
> > <plugin>
> > <groupId>org.antlr</groupId>
> > <artifactId>antlr3-maven-plugin</artifactId>
> > <version>3.4</version>
> > <executions>
> > <execution>
> > <phase>generate-sources</phase>
> > <goals>
> > <goal>antlr</goal>
> > </goals>
> > <configuration>
> > <sourceDirectory>src/main/antlr3</sourceDirectory>
> > <libDirectory>src/main/antlr3/imports</libDirectory>
> > <outputDirectory>src/main/java</outputDirectory>
> > <printGrammar>false</printGrammar>
> > <profile>false</profile>
> > <report>true</report>
> > <trace>false</trace>
> > <verbose>true</verbose>
> > <debug>false</debug>
> > <dfa>false</dfa>
> > <nfa>false</nfa>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> > My problem is that when I launch a project build from the Eclipse IDE,
> > the java builder is applied first and then the maven builder, by
> > default. Thus compilation occurs
> > before code generation, which is managed by maven.
> > This cause my test classes, which have dependencies upon generated lexer
> > and parser not to compile :
>
>
> > public class Test {
> > >  public static void main(String[] args) throws Exception {
> > > > .....
> > > >  TLexer lexer = new TLexer(input); -> error
> > >>>> ......
> > > >  TParser parser = new TParser(tokens); -> error
> > > >  parser.r();
> > >  }
> > }
> > I have to build the project a second time to have the errors removed. As
> > a workaround, I can modify the builder order in the project's properties
> > screen  using UP or DOWN buttons.
> > But every time I change my pom.xml and fire an 'Update Project
> > Configuration...', the .project file, which stores the used builders and
> > their application order is reset to defaults.
> > Googling a little bit, I found this link
> > https://issues.sonatype.org/browse/MNGECLIPSE-707, indicating that it's
> > the intended behavior in order to solve a resource clean issue when the
> > builder order is changed.
> > I tried to issue a clean within Eclipse Indigo using 'Project ->
> > Clean...' menu, and seems to work (resources and classes are effectively
> > deleted), even if maven builder is set in first position.
>
>
> > Is it really necessary the reset the builder's order after an 'Update
> > Project Configuration...' ?
> > Is there another way to force m2e and maven launch code generation
> > before compilation using Eclipse tooling and not the mvn command  ?
> > Thanks for any answer or hint.
>



Back to the top