Brett, 

Thanks for this reply. I've got a bit further but have reached another
sticking point. What I'm trying to do is: get the dotnet compiler working
for ms csc and mono msc, also I'm writing plugins to wrap NUnit and NDoc so
that there can be a roughly similar dotnet build as the java build.

In the Dotnet Compiler components.xml I have:

<component-set>
  <components>
  
    <component>
      <role>org.codehaus.plexus.compiler.Compiler</role>
      <role-hint>csharp</role-hint>
 
<implementation>org.codehaus.plexus.compiler.csharp.CSharpCompiler</implemen
tation>
    </component>
  
      <component>
        <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
        <role-hint>dotnet-assembly</role-hint>
 
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</
implementation>
        <configuration>
          <phases>
            <process-resources>resources:resources</process-resources>
            <compile>compiler:compile</compile>
 
<process-test-resources>resources:testResources</process-test-resources>
            <test-compile>compiler:testCompile</test-compile>
            <test>surefire:test</test>
            <!--package>package:package</package -->
            <install>install:install</install>
            <deploy>deploy:deploy</deploy>
          </phases>
        </configuration>
      </component>
      
      <component> 
             <role>org.apache.maven.artifact.handler.ArtifactHandler</role> 
             <role-hint>dotnet-assembly</role-hint> 
 
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</im
plementation> 
              <configuration> 
                 <type>dotnet-assembly</type> 
                 <extension>dll</extension> 
                 <packaging>native</packaging>
             </configuration> 
    </component>
      
    </components>
  
</component-set>

I've managed to get this to build and install in my local cache.

Then I've created a test project with this as the pom:


<project>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>engn-maven-csharp-test</artifactId>
        <groupId>engn-maven-csharp</groupId>
        <name>Engine CSharp Test</name>
        <version>0.1</version>
        <packaging>dotnet-assembly</packaging>

        <build>
                <directory>target</directory>
                <outputDirectory>target/dotnet-assemblies</outputDirectory>
                <testOutputDirectory>
                        target/test-dotnetassemblies
                </testOutputDirectory>
                <sourceDirectory>src/main/csharp</sourceDirectory>
                <!--
scriptSourceDirectory>src/main/scripts</scriptSourceDirectory -->
                <testSourceDirectory>src/test/csharp</testSourceDirectory>
                <resources>
                        <resource>
                                <directory>src/main/resources</directory>
                        </resource>
                </resources>
                <testResources>
                        <testResource>
                                <directory>src/test/resources</directory>
                        </testResource>
                </testResources>

                <plugins>
                        <plugin>
        
<artifactId>maven-compiler-plugin</artifactId>
                                <version>1.5.1</version>
                                <configuration>
                                        <compilerId>csharp</compilerId>
                                </configuration>
                                <dependencies>
                                        <dependency>
        
<groupId>org.codehaus.plexus</groupId>
        
<artifactId>plexus-compiler-csharp</artifactId>
        
<version>1.6-SNAPSHOT</version>
                                        </dependency>
                                </dependencies>
                        </plugin>
                </plugins>

        </build>

        <dependencies>
                <dependency>
                        <groupId>ant</groupId>
                        <artifactId>ant-nodeps</artifactId>
                        <version>1.6.5</version>
                </dependency>
                <dependency>
                        <groupId>ant</groupId>
                        <artifactId>ant</artifactId>
                        <version>1.6.5</version>
                </dependency>
                <dependency>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-utils</artifactId>
                        <version>1.0.4</version>
                </dependency>
        </dependencies>
</project>

I'm then trying to execute the goal like so on this test project (is this
the correct syntax?):

C:\Work\Eclipse\Workspace\trunk\Dev.Maven.CSharpTestProject>mvn
org.codehaus.plexus:plexus-compiler-csharp:compile 
-Duser.home=C:\Work\SCM\CVS\CPDS\trunk\m2.user.home -e -X

And I get this exception:

C:\Work\Eclipse\Workspace\trunk\Dev.Maven.CSharpTestProject>mvn
org.codehaus.plexus:plexus-compiler-csharp:compile
-Duser.home=C:\Work\SCM\CVS\CPDS\trunk\m2.user.home -e -X
+ Error stacktraces are turned on.
[DEBUG] Building Maven user-level plugin registry from:
'C:\Work\SCM\CVS\CPDS\trunk\m2.user.home\.m2\plugin-registry.xml'
[DEBUG] Building Maven global-level plugin registry from: 'C:\Program
Files\Apache Software Foundation\Maven 2\maven-2.0\conf\plugin-registry.xml'
[INFO] Scanning for projects...
[DEBUG] plexus-compiler-csharp: using locally installed snapshot
[DEBUG] Artifact not found - using stub model: Unable to determine the
latest version
  org.codehaus.plexus:plexus-compiler-csharp:LATEST:pom


[DEBUG] Using defaults for missing POM
org.codehaus.plexus:plexus-compiler-csharp:pom:LATEST
[DEBUG] plexus-compiler-csharp: using locally installed snapshot
[DEBUG] Artifact not found - using stub model: Unable to determine the
release version
  org.codehaus.plexus:plexus-compiler-csharp:RELEASE:pom


[DEBUG] Using defaults for missing POM
org.codehaus.plexus:plexus-compiler-csharp:pom:RELEASE
[INFO]
----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
----------------------------------------------------------------------------
[INFO] The plugin 'org.codehaus.plexus:plexus-compiler-csharp' does not
exist or no valid version could be found
[INFO]
----------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: The plugin
'org.codehaus.plexus:plexus-compiler-csharp' does not exist or no valid
version cou
ld be found
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLife
cycleExecutor.java:1124)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(Defaul
tLifecycleExecutor.java:1356)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggrega
tionNeeds(DefaultLifecycleExecutor.java:376)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:132)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.version.PluginVersionNotFoundException:
The plugin 'org.codehaus.plexus:plexus-compiler-csharp' does not exist or n
o valid version could be found
        at
org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVer
sion(DefaultPluginVersionManager.java:225)
        at
org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVer
sion(DefaultPluginVersionManager.java:87)
        at
org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManag
er.java:158)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLife
cycleExecutor.java:1095)
        ... 14 more
[INFO]
----------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Oct 25 16:42:53 BST 2005
[INFO] Final Memory: 1M/2M
[INFO]
----------------------------------------------------------------------------

I know it is probably something very school-boy that I'm doing wrong but no
matter what I do I can't get maven to load the plugin from my cache, it
seems to always want to get it from central, and when it can't it fails.
I've tried compiling the plugin as a true version (1.6.1) and setting the
dependency to that, and setting the parent pom of plugin to a 1.5.1 rather
than 1.6-snapshot but nothing seems to work.

The pom of the dotnet plugin is included below:

<project>
  
  <parent>
    <artifactId>plexus-compilers</artifactId>
    <groupId>org.codehaus.plexus</groupId>
    <version>1.6-SNAPSHOT</version>
  </parent>
  
  <modelVersion>4.0.0</modelVersion>
  <artifactId>plexus-compiler-csharp</artifactId>
  <groupId>org.codehaus.plexus</groupId>
  <name>Plexus C# Compiler</name>
  <version>1.6-SNAPSHOT</version>
  
  <dependencies>
    <dependency>
      <groupId>ant</groupId>
      <artifactId>ant-nodeps</artifactId>
      <version>1.6.5</version>
    </dependency>
    <dependency>
      <groupId>ant</groupId>
      <artifactId>ant</artifactId>
      <version>1.6.5</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>1.0.4</version>
    </dependency>
  </dependencies>
  
</project>


Any pointers would really help,

Thanks,

Chris



-----Original Message-----
From: Brett Porter [mailto:[EMAIL PROTECTED] 
Sent: 25 October 2005 02:02
To: Maven Users List
Subject: Re: [m2] Defining Custom Compiler in POM

1) put the components bit in components.xml for your compiler JAR
2) add your jar as a dependency within the compiler plugin element in build
3) add the compilerId configuration to the compiler plugin

So, untested, but something like this:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <compilerId>mycustomcompiler</compilerId>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>com.mycompany</groupId>
      <artifactId>my-custom-compiler</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
  </dependencies>
</plugin>

HTH,
Brett

On 10/24/05, Stevenson, Chris <[EMAIL PROTECTED]> wrote:
> Dear All,
>
> Does anyone know how to specify a custom compiler in the pom of a 
> project that wishes to use it?
>
> Am i correct in thinking that to make plexus/maven aware of a custom 
> compiler I need to:
>
> a) Define a role/component in the components.xml of the compiler so 
> that plexus can find it?
>
> <component-set>
>   <components>
>     <component>
>       <role>org.codehaus.plexus.compiler.Compiler</role>
>       <role-hint>mycustomcompiler</role-hint>
>       
> <implementation>uk.co.blah.blah.compiler.CompilerImpl</implementation>
>
>     </component>
>   </components>
> </component-set>
>
> b) add a reference to my compiler as a dependency? (can Ijust add it 
> as a normal dep?)
>
> c) tell maven to use my compiler instead of the defaul javac (this is 
> the real corker...)
>
> Any help much appreciated.
>
> Chris S
>
>
>
> Chris Stevenson
>
> Dresdner Kleinwort Wasserstein
>
>
>
>
>
>
> ----------------------------------------------------------------------
> ---------- 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
> ----------------------------------------------------------------------
> ----------
>
>
>

---------------------------------------------------------------------
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
--------------------------------------------------------------------------------


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

Reply via email to