Good day to you, Martin M.,

Yes. I believe that your plugin does get executed ( since you did mention
that you were getting null in your test param, meaning that it did run :) ).
However, that does not mean that it is what you were configuring.

Ok, you played around with the built-in lifecycle so that your custom
compiler is ran, which I think you accomplished. 

Next, you tried setting the value of your test parameter which you failed (
since you said it's always null ). My suggestion then is that to use the
whole artifact key ( groupId:artifactId:version ) during the configuration.
Just like what you did with this

<plugin>
  <groupId>mygroup</groupId>
  <artifactId>customCompile</artifactId>
  <version>1.0-SNAPSHOT</version>
  <executions>
    <execution>
      <id>custom-compilation</id>
      <phase>compile</phase>
      <configuration>
        <testParam>testValue</testParam>
      </configuration>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin> 

Notice that in the snippet above, you mentioned that you're setting the
testParam value of mygroup:customCompile:1.0-SNAPSHOT. While in the snippet
below

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <testParam>c1</testParam>
  </configuration>

  <dependencies>
    <dependency>
      <groupId>mygroup</groupId>
      <artifactId>customCompile</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
  </dependencies>
</plugin>

you were configuring the testParam of a plugin with the artifactId
maven-compiler-plugin ( which could be
org.apache.maven.plugins:maven-compiler-plugin:RELEASE or some custom
maven-compiler-plugin that you made ).

Thus, in the post you made in [1], you were configuring some plugin with an
artifactId maven-compiler-plugin eventhough you were running
mygroup:customCompile:1.0-SNAPSHOT.

Thanks,
Franz

[1]
http://www.nabble.com/Re%3A-passing-custom-parameters-to-a-custom-compiler-plugin-p8281436s177.html


Martin M wrote:
> 
> Hi all,
> 
> @Jörg
> I tried your suggestion, but it didn't work. As I understood the 
> documentation the expression-syntax is for properties and not for 
> parameters.
> 
> @Franz
> During compile phase, my compiler is definitely used. I can see the output 
> and the execution of the goal in maven's output.
> The only problem is the parameter passing.
> 
> In the meantime I found a workaround. But I would like to know the proper 
> way to implement such a plugin.
> 
> As workaround I did following:
> 
> .) Disable the compiler in the components.xml. So no <compile> tag is 
> defined for <role-hint>jar</role-hint>
> 
> .) Call the plugin in the pom.xml like this:
>  <plugin>
>            <groupId>mygroup</groupId>
>            <artifactId>customCompile</artifactId>
>            <version>1.0-SNAPSHOT</version>
>            <executions>
>            <execution>
>            <id>custom-compilation</id>
>            <phase>compile</phase>
>            <configuration>
>            <testParam>testValue</testParam>
>              </configuration>
>            <goals>
>            <goal>compile</goal>
>            </goals>
>            </execution>
>            </executions>
> </plugin>
> 
> 
> 
> 
> 
> Regards,
> Martin
> 
> --On Donnerstag, Januar 11, 2007 23:04:40 -0800 franz see 
> <[EMAIL PROTECTED]> wrote:
> 
>>
>> Good day,
>>
>> Actually, using @parameter only should be sufficient for it to be
>> configured via the pom. The @expression is used for setting the parameter
>> via commandline.
>>
>> Anyway, Martin M., try specifying in your plugin tag the groupId and
>> version as well. It might still be trying to configure
>> org.apache.maven.plugins:maven-compiler-plugin:RELEASE instead of your
>> custom compiler plugin.
>>
>> Cheers,
>> Franz
>>
>>
>> Jörg Schaible wrote:
>>>
>>> Hi Martin,
>>>
>>>
>>> there's no automation. You need to provide the expression for the
>>> parameter to initialize:
>>>
>>> [snip]
>>>
>>>      /**
>>>       * @parameter expression="${testParam}"
>>>       **/
>>>      private String testParam
>>>
>>> [snip]
>>>
>>> Within the expression you can also address other parts of the POM ...
>>> another typical parameter is:
>>>
>>>     /**
>>>      * The directory for the generated file.
>>>      *
>>>      * @parameter expression="${project.build.directory}"
>>>      * @required
>>>      */
>>>     private String outputDirectory;
>>>
>>> - Jörg
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/passing-custom-parameters-to-a-custom-compiler-plug
>> in-tf2958426s177.html#a8292757 Sent from the Maven - Users mailing list
>> archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
> 
> 
> 
> --
> Martin Moser
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/passing-custom-parameters-to-a-custom-compiler-plugin-tf2958426s177.html#a8312544
Sent from the Maven - Users mailing list archive at Nabble.com.


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

Reply via email to