Hi Pieter,
just put it directly in your maven.xml:
<project xmlns:j="jelly:core" xmlns:m="jelly:maven"
xmlns:ant="jelly:ant" xmlns:util="jelly:util">
<preGoal name="java:compile">
<attainGoal name="generatesomecode"/>
<ant:path id="gen.src.dir" location="${maven.build.src}"/>
<m:addPath id="maven.compile.src.set" refid="gen.src.dir"/>
</preGoal>
</project>
The Pre-Goal for "java:compile" will make sure that the goal
"generatesomecode" will be called before the compile is performed. In a
way it is as decorator for "java:compile"...
-Stefan
--
http://www.kleineikenscheidt.de/stefan
> -----Original Message-----
> From: Pieter Van Gorp [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 23, 2005 11:45 PM
> To: Stefan Kleineikenscheidt
> Cc: [EMAIL PROTECTED]
> Subject: Re: Forcing a recompile of Java sources
>
>
> Hi Stefan,
> sounds interesting, we'll try it out!
>
> Still, it's not completely clear to me where I should place the
> preGoal tag. Should it be nested in the AndroMDA one? Seeing the
> attainGoal tag, I would say not but where does it belong otherwise?
> Perhaps it should be nested in the goal that is dedicated to compiling
> the generated sources? In that case it would indeed be the equivalent
> of our "ANT build-gensrc" target... on the other hand I wouldn't know
> what the body of the Maven rule would be: what would the goal contain
> besides the preGoal you mention?
>
> Thanks for your insight,
> Pieter.
>
> On Wed, 23 Feb 2005 21:04:37 +0100, Stefan Kleineikenscheidt
> <[EMAIL PROTECTED]> wrote:
> >
> > Hi Pieter,
> >
> > i prefer to clearly separate generated sources from the
> manually edited
> > sources. Therefore we generate our sources to
> ${maven.build.src} and
> > add this path for java:compile like this:
> >
> > <preGoal name="java:compile">
> > <attainGoal name="generatesomecode"/>
> > <ant:path id="gen.src.dir" location="${maven.build.src}"/>
> > <maven:addPath id="maven.compile.src.set"
> refid="gen.src.dir"/>
> > </preGoal>
> >
> > ('generatesomecode' would be replaced by the andromda goal
> in your case)
> >
> > Hope this helps,
> > -Stefan
> >
> > --
> > http://www.kleineikenscheidt.de/stefan
> >
> > > -----Original Message-----
> > > From: Pieter Van Gorp [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, February 23, 2005 2:04 PM
> > > To: Maven Users List; Brett Porter
> > > Subject: Re: Forcing a recompile of Java sources
> > >
> > >
> > > Hi Brett,
> > > thanks for your reply.
> > >
> > > > I'm not sure what you are using to generate sources
> > > I'm using AndroMDA (http://andromda.sourceforge.net/) to
> generate Java
> > > sources from UML models.
> > >
> > > > but it must be
> > > > adding the generated sources to the source path
> (<maven:addPath />),
> > > Do you mean that we have to extend the sourceDirectory
> from the build
> > > tag in project.xml by telling Maven the generated sources
> are located
> > > elsewhere? In fact, the sources are already generated in
> > > project.xml's sourceDirectory itself so I thought that the regular
> > > build goal would work for the AndroMDA-generated sources
> as well as
> > > for non-generated sources... Where am I wrong?
> > >
> > > > You'll need to get that tag called first - either by adding the
> > > > preGoal yourself, or calling the appropriate goal from
> the source
> > > > generator.
> > > The goal that is not working as it should is 'build'.
> AndroMDA has
> > > already done it's job and the generated sources have been modified
> > > manually (for displaying debug output) so should be
> recompiled without
> > > running AndroMDA again. Does this comply with your solution?
> > >
> > > Best regards,
> > > Pieter.
> > >
> > > On Wed, 23 Feb 2005 21:43:44 +1100, Brett Porter
> > > <[EMAIL PROTECTED]> wrote:
> > > > I'm not sure what you are using to generate sources,
> but it must be
> > > > adding the generated sources to the source path
> (<maven:addPath />),
> > > > and when that is skipped, it is not attempting to compile
> > > them at all.
> > > >
> > > > You'll need to get that tag called first - either by adding the
> > > > preGoal yourself, or calling the appropriate goal from
> the source
> > > > generator.
> > > >
> > > > - Brett
> > > >
> > > > On Wed, 23 Feb 2005 10:49:21 +0100, Pieter Van Gorp
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > Hi all,
> > > > > if I should give any extra info to get this question
> > > answered, please
> > > > > let me know.
> > > > >
> > > > > In the meanwhile, I'm driving the on-demand
> recompilation of the
> > > > > selected sources (the generated ones) from ANT again. Is
> > > it perhaps
> > > > > impossible (or undesirable) to use Maven exclusively (=
> > > only maven.xml
> > > > > and project.xml but no ANT build.xml) for our project
> > > requirements?
> > > > >
> > > > > Kind regards,
> > > > > Pieter Van Gorp
> > > > > http://motmot.sourceforge.net/
> > > > >
> > > > > ---------- Forwarded message ----------
> > > > > From: Pieter Van Gorp <[EMAIL PROTECTED] >
> > > > > Date: Mon, 21 Feb 2005 21:08:02 +0100
> > > > > Subject: Forcing a recompile of Java sources
> > > > > To: [email protected]
> > > > >
> > > > > Hi, since recently we've moved the build process of our
> > > MDA tool from
> > > > > ANT to Maven. I can't find out how we should set up our
> > > build process
> > > > > to get the effect of our previous ANT target
> "build-gensrc" which
> > > > > compiled the generated source of a particular model
> without first
> > > > > regenerating it. We need this kind of build target
> because it is
> > > > > useful to include manual debug output in generated sources.
> > > > >
> > > > > I hoped that "maven java:compile" would do the trick
> for us but
> > > > > apparantly Maven does not notice the manual changes to
> > > the generated
> > > > > Java file:
> > > > > [echo] No java source files to compile
> > > > >
> > > > > I can't imagine that there's a bug in Maven concerning
> > > the comparison
> > > > > between the time stamp of the Java sources with the
> corresponding
> > > > > classfiles so probably I'm doing something wrong.
> > > > >
> > > > > Can anybody please help us understanding the Maven
> > > approach to manage
> > > > > builds for generated applications better?
> > > > >
> > > > > Thanks a lot in advance,
> > > > > --
> > > > > Pieter Van Gorp
> > > > > Teaching and Research Assistant
> > > > > FOrmal Techniques in Software engineering (FOTS)
> > > > > University of Antwerp
> > > > > Middelheimlaan 1
> > > > > 2020 Antwerpen - Belgium
> > > > > Office: G.304
> > > > > Phone: +32 3 265 38 71
> > > > > Fax: +32 3 265 37 77
> > > > > http://www.fots.ua.ac.be/~pvgorp/research/
> > > > > http://motmot.sourceforge.net/
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]