You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Eduardo M KALINOWSKI <ed...@kalinowski.com.br> on 2010/01/29 12:21:42 UTC
Compile what can be compiled, ignore sources with errors
Is there a way to configure Maven to ignore source files that present
errors during compilation, and compile everything that is possible
(that is, has no error)?
I've set maven-compiler-plugin's failOnError option to "false", and
the build is considered successful despite the errors. However, no
classes are generated. Our jar file is even created, but it has
nothing except the META-INF directory.
I believe the problem happens because it's a big project (229 source
files as of now). I created a simple project with two sources, and
even without failOnError=true the source with no errors was compiled.
But when I created a lot more sources with errors, nothing was
generated. Apparently after some number of errors Maven gives up and
does not try to compile anything else. Is that assumption correct? I
couldn't find any information on that.
One possible way to solve the problem would be to manually list the
files to be excluded, and remove them from the list as they get fixed.
But this is tedious and error-prone, so I wonder if there is a better
way.
--
Eduardo M KALINOWSKI
eduardo@kalinowski.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Compile what can be compiled, ignore sources with errors
Posted by Antonio Petrelli <an...@gmail.com>.
2010/1/29 Eduardo M KALINOWSKI <ed...@kalinowski.com.br>:
> One possible way to solve the problem would be to manually list the files to
> be excluded, and remove them from the list as they get fixed. But this is
> tedious and error-prone, so I wonder if there is a better way.
Sure, complain with your team. Having a project that does not compile
is simply incorrect, not to mention the sarcasm that it may cause,
such as the famous "Every build you break" song on YouTube :-D Or the
"sheep" of shame (usually a toy) that is given to the one who breaks
the build.
Have fun :-D
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Compile what can be compiled, ignore sources with errors
Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Eduardo,
a solution would be
+) create a project in the IDE of your choice
+) fix the errors incrementally
Cheers,
Siegfried Goeschl
Eduardo M KALINOWSKI wrote:
> Is there a way to configure Maven to ignore source files that present
> errors during compilation, and compile everything that is possible
> (that is, has no error)?
>
> I've set maven-compiler-plugin's failOnError option to "false", and
> the build is considered successful despite the errors. However, no
> classes are generated. Our jar file is even created, but it has
> nothing except the META-INF directory.
>
> I believe the problem happens because it's a big project (229 source
> files as of now). I created a simple project with two sources, and
> even without failOnError=true the source with no errors was compiled.
> But when I created a lot more sources with errors, nothing was
> generated. Apparently after some number of errors Maven gives up and
> does not try to compile anything else. Is that assumption correct? I
> couldn't find any information on that.
>
> One possible way to solve the problem would be to manually list the
> files to be excluded, and remove them from the list as they get fixed.
> But this is tedious and error-prone, so I wonder if there is a better
> way.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Compile what can be compiled, ignore sources with errors
Posted by Antonio Petrelli <an...@gmail.com>.
2010/1/29 Eduardo M KALINOWSKI <ed...@kalinowski.com.br>:
> For example, a method name may be
> changed. This will break everywhere that calls the method.
Refactoring anyone? Or deprecations?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Compile what can be compiled, ignore sources with errors
Posted by Justin Edelson <ju...@gmail.com>.
Eduardo-
AFAIK, the behavior you are seeing is the behavior of javac, not Maven. As
you note, the Eclipse compiler does something different, so if that's the
behavior you want, use the Eclipse compiler.
Justin
On Fri, Jan 29, 2010 at 8:21 AM, Eduardo M KALINOWSKI <
eduardo@kalinowski.com.br> wrote:
> On Sex, 29 Jan 2010, Christoph Kutzinski wrote:
>
>> Sounds to me like you should modularize the application, make a
>> multi-module project of it (if not already) and then add only those modules
>> on which you're working currently to the <modules> section of the parent POM
>> and leave out all the others for the moment.
>> Just a quick idea from the top of my head.
>>
>
> It is already a multi-module application. Some modules are OK, but the
> problems I'm referring to happen in only one of the modules (well, two
> actually).
>
>
> The alternative you mentioned - try to compile everything and just hope at
>> runtime that all currently needed functionality is working - sounds
>> inherently dangerous to me.
>>
>
> Yes, it is dangerous. But it works fine when building with Eclipse.
> Apparently Eclipse does just that, compiling what can be compiled and
> including that in the final war (or whatever else is being generated).
>
>
>
> --
> Your mileage may vary.
>
>
> Eduardo M KALINOWSKI
> eduardo@kalinowski.com.br
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Compile what can be compiled, ignore sources with errors
Posted by Eduardo M KALINOWSKI <ed...@kalinowski.com.br>.
On Sex, 29 Jan 2010, Christoph Kutzinski wrote:
> Sounds to me like you should modularize the application, make a
> multi-module project of it (if not already) and then add only those
> modules on which you're working currently to the <modules> section
> of the parent POM and leave out all the others for the moment.
> Just a quick idea from the top of my head.
It is already a multi-module application. Some modules are OK, but the
problems I'm referring to happen in only one of the modules (well, two
actually).
> The alternative you mentioned - try to compile everything and just
> hope at runtime that all currently needed functionality is working -
> sounds inherently dangerous to me.
Yes, it is dangerous. But it works fine when building with Eclipse.
Apparently Eclipse does just that, compiling what can be compiled and
including that in the final war (or whatever else is being generated).
--
Your mileage may vary.
Eduardo M KALINOWSKI
eduardo@kalinowski.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Compile what can be compiled, ignore sources with errors
Posted by Christoph Kutzinski <ku...@gmx.de>.
Sounds to me like you should modularize the application, make a
multi-module project of it (if not already) and then add only those
modules on which you're working currently to the <modules> section of
the parent POM and leave out all the others for the moment.
Just a quick idea from the top of my head.
The alternative you mentioned - try to compile everything and just hope
at runtime that all currently needed functionality is working - sounds
inherently dangerous to me.
Eduardo M KALINOWSKI schrieb:
> On Sex, 29 Jan 2010, Christoph Kutzinski wrote:
>> The obvious counter question is:
>> Why do you want to do this? Why not just fix the compile errors?
>
> To make a long story short: we received this project from another
> company, and we have to fix it and complete the parts that are missing.
>
> We are doing this in incremental steps, naturally. Sometimes we make
> changes that break other parts of the project. For example, a method
> name may be changed. This will break everywhere that calls the method.
> This gets fixed in the parts that we are currently working on, but in
> other parts, we ignore them for now. When work is started on those
> parts, they'll have to get fixed.
>
> It's true that in the end everything will have to compile without
> errors. But at this moment, we need the parts that are OK to be
> compiled, so that the application (it's a web application) can be run
> and those parts be tested. As for what's still with errors, they at the
> moment aren't being called. Naturally, if they were called, a run-time
> error would show up. That's OK by now.
>
> I hope this clears up the reasons. I know it's a weird request, but this
> situation is not permanent. As the project progresses, this will simply
> not be necessary anymore.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Compile what can be compiled, ignore sources with errors
Posted by Eduardo M KALINOWSKI <ed...@kalinowski.com.br>.
On Sex, 29 Jan 2010, Christoph Kutzinski wrote:
> The obvious counter question is:
> Why do you want to do this? Why not just fix the compile errors?
To make a long story short: we received this project from another
company, and we have to fix it and complete the parts that are missing.
We are doing this in incremental steps, naturally. Sometimes we make
changes that break other parts of the project. For example, a method
name may be changed. This will break everywhere that calls the method.
This gets fixed in the parts that we are currently working on, but in
other parts, we ignore them for now. When work is started on those
parts, they'll have to get fixed.
It's true that in the end everything will have to compile without
errors. But at this moment, we need the parts that are OK to be
compiled, so that the application (it's a web application) can be run
and those parts be tested. As for what's still with errors, they at
the moment aren't being called. Naturally, if they were called, a
run-time error would show up. That's OK by now.
I hope this clears up the reasons. I know it's a weird request, but
this situation is not permanent. As the project progresses, this will
simply not be necessary anymore.
--
You're being followed. Cut out the hanky-panky for a few days.
Eduardo M KALINOWSKI
eduardo@kalinowski.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Compile what can be compiled, ignore sources with errors
Posted by "Mark H. Wood" <mw...@IUPUI.Edu>.
On Fri, Jan 29, 2010 at 12:31:06PM +0100, Christoph Kutzinski wrote:
> Why do you want to do this? Why not just fix the compile errors?
Likely the same reason that compiler writers have spent so much time
studying error recovery in parsers: to discover as many errors as
possible in one iteration. Fewer iterations, each one more
productive.
You also get a better feel for just how buggy the code is, and for
patterns of problems, by seeing everything that *doesn't* fail to
compile. It's useful to be able to answer questions like, "this is
happening all over the place -- is there a deeper problem?"
Of course that has to be balanced against the fact that, when
compiling X against broken Y, you may not get a true picture of the
status of X.
--
Mark H. Wood, Lead System Programmer mwood@IUPUI.Edu
Friends don't let friends publish revisable-form documents.
Re: Compile what can be compiled, ignore sources with errors
Posted by Christoph Kutzinski <ku...@gmx.de>.
The obvious counter question is:
Why do you want to do this? Why not just fix the compile errors?
Eduardo M KALINOWSKI schrieb:
> Is there a way to configure Maven to ignore source files that present
> errors during compilation, and compile everything that is possible (that
> is, has no error)?
>
> I've set maven-compiler-plugin's failOnError option to "false", and the
> build is considered successful despite the errors. However, no classes
> are generated. Our jar file is even created, but it has nothing except
> the META-INF directory.
>
> I believe the problem happens because it's a big project (229 source
> files as of now). I created a simple project with two sources, and even
> without failOnError=true the source with no errors was compiled. But
> when I created a lot more sources with errors, nothing was generated.
> Apparently after some number of errors Maven gives up and does not try
> to compile anything else. Is that assumption correct? I couldn't find
> any information on that.
>
> One possible way to solve the problem would be to manually list the
> files to be excluded, and remove them from the list as they get fixed.
> But this is tedious and error-prone, so I wonder if there is a better way.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org