You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Pieter Van Gorp <pi...@gmail.com> on 2005/02/21 21:08:02 UTC

Forcing a recompile of Java sources

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Forcing a recompile of Java sources

Posted by Stefan Kleineikenscheidt <st...@kleineikenscheidt.de>.
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:pietervangorp@gmail.com] 
> 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 
> <br...@gmail.com> 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
> > <pi...@gmail.com> 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 <pietervangorp@gmail.com >
> > > Date: Mon, 21 Feb 2005 21:08:02 +0100
> > > Subject: Forcing a recompile of Java sources
> > > To: users@maven.apache.org
> > >
> > > 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: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Forcing a recompile of Java sources

Posted by Pieter Van Gorp <pi...@gmail.com>.
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 <br...@gmail.com> 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
> <pi...@gmail.com> 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 <pietervangorp@gmail.com >
> > Date: Mon, 21 Feb 2005 21:08:02 +0100
> > Subject: Forcing a recompile of Java sources
> > To: users@maven.apache.org
> >
> > 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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Forcing a recompile of Java sources

Posted by Brett Porter <br...@gmail.com>.
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
<pi...@gmail.com> 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 <pietervangorp@gmail.com >
> Date: Mon, 21 Feb 2005 21:08:02 +0100
> Subject: Forcing a recompile of Java sources
> To: users@maven.apache.org 
> 
> 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: users-unsubscribe@maven.apache.org 
> For additional commands, e-mail: users-help@maven.apache.org 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Fwd: Forcing a recompile of Java sources

Posted by Pieter Van Gorp <pi...@gmail.com>.
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 <pi...@gmail.com>
Date: Mon, 21 Feb 2005 21:08:02 +0100
Subject: Forcing a recompile of Java sources
To: users@maven.apache.org


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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org