Hi Adrian,

I agree, there is quite a lot of complexity involved in setting up new
compilers. I think this is firstly so that there can be some reuse, I did
use some of the abstract compiler stuff when adding to the dotnet compiler. 

The second reason for the complexity is so that they are reusable components
in plexus, which I think that the maven bods are trying to push as an AOP
container in its own right. 

I think the failing point in your generic command line plugin is that you
can't do advanced conviguration of it through the pom. 

Ex.

Say I have two directories

src/main/java
src/main/java-extra

And I want to compile eveything from both folders into my resulting jar
except the package org.apache.ignoreme, how would you see this functionality
being implemented with just a drop out to the command line. In the compiler
plugin you can quite easily add includes and excludes elements etc...

I agree that some of the functionality is redundant across different
compilers (some of the stuff did not apply at all for my CSharp stuff, like
the stale source scanner) but some of it did, I used the compiler
configuration quite extensively. 

In the end I think its just the way Brett and the guys chose to model it. 

If you have any specific issues with implementing the stuff, I'd be happy to
help out.

Regards,

Chris

-----Original Message-----
From: Adrian Herscu [mailto:[EMAIL PROTECTED] 
Sent: 27 February 2006 06:30
To: Stevenson, Chris
Subject: Re: [m2] HOWTO: Compilers

Hi Chris,

Consider this pom.xml fragment:

<build>
  <plugin>
    <groupId>org.foo</groupId>
    <artifactId>generic-commandline-plugin</artifactId>
    <executions>
      <execution>
        <id>execution-id</id>
        <phase>phase-id</phase>
        <goals>
          <goal>execute</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <executablePath>${foo.home}/bin/foo</executablePath>
      <arguments><!CDATA[ insert your args here ]]></arguments>
    </configuration>
  </plugin>
</build>

Then the generic-commandline-plugin would launch the ${foo.home}/bin/foo and
pass it the arguments string as is.
Wouldn't it be *much* simpler to implement than the current compiler
plugins?

I have downloaded the Maven sources and started to debug the
maven-compiler-plugin. (BTW, the Doodle Project provides a .NET plugin for
M2, but I have not tested it yet)

After one day of debugging (!), I still cannot understand why it is so
complicated to spawn an OS process and pass it arguments!

One example of this over complexity is the
org.codehaus.plexus.compiler.CompilerConfiguration class, which is used to
pass arguments to the javac compiler (of course, it is useless for other
types of compilers).

Another example is the org.apache.maven.plugin.AbstractCompilerMojo
class which checks if there are newer sources to compile and if it finds
such then it invokes the compiler, otherwise it logs "Nothing to compile
- all classes are up to date". Why is this needed? Isn't this the compiler's
job?

What am I missing?
Please comment,
Adrian.

Stevenson, Chris wrote:
> Hi Adrian,
> 
> I've had a bit of a play around with custom compilers, if you'd like 
> to look at some source on how to do it you can download my CSharp stuff
from JIRA:
> 
> http://jira.codehaus.org/browse/MOJO-304
> 
> The specific bits of interest to you should be;
> 
> plugins\csharp-maven-plugin\src\main\resources\META-INF\plexus\compone
> nts.xm l (which makes plexus aware of the compiler)
> 
> plugins\sample\maven-sample-csharp_exe\pom.xml (which shows how you to 
> plumb the compiler into maven using the maven compiler plugin.
> 
> If you have any more issues, please email. I'll try and help.
> 
> Chris
> 
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Adrian Herscu
> Sent: 23 February 2006 13:38
> To: [email protected]
> Subject: [m2] HOWTO: Compilers
> 
> Hi all,
> 
> I am trying to understand how compilers are invoked by M2 and 
> eventually how to add support for my own compiler.
> 
> Please explain how M2 relates to Plexus (in other words why M2 needs 
> Plexus?).
> 
> Do I need to build my compiler support as a Plexus component?
> 
> Is it possible to reuse existing M2 compiler support (i.e. from
> maven-compiler-plugin) for my own compiler? How?
> 
> Thanks,
> Adrian.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ----------------------------------------------------------------------
> ---------- The information contained herein is confidential and is 
> intended solely for the addressee. Access by any other party is 
> unauthorised without the express written permission of the sender. If 
> you are not the intended recipient, please contact the sender either 
> via the company switchboard on +44 (0)20 7623 8000, or via e-mail 
> return. If you have received this e-mail in error or wish to read our 
> e-mail disclaimer statement and monitoring policy, please refer to 
> http://www.drkw.com/disc/email/ or contact the sender. 3167
> ----------------------------------------------------------------------
> ----------
 ------


--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express 
written permission of the sender. If you are not the intended recipient, please 
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender. 3166
--------------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to