You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jallen <jo...@hotmail.com> on 2007/07/09 16:08:55 UTC

Plugin configuration for specific goals - doc error?

Hi all,

As per the rather excellent guide available at Sonatypes website
(http://www.sonatype.com/book/using-plugins.html#configuring_plugins): 

One is told that the following two compiler plugin configurations are
synonymous:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.4</source>
          <target>1.4</target>
        </configuration>
      </plugin>

..

and


<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <source>1.4</source>
              <target>1.4</target>
            </configuration>
          </execution>
        </executions>
      </plugin>

However from a number of trials using compiler plugin version 2.0.2 and
maven 2.0.7 we have been unable to get this to work.

The global style plugin configuration works, with both Mojos getting the
correct configuration.
The Goal set based configuration properly configures the 'compile' goal but
does not configure the 'testCompile' goal.

Varying where the testCompile goal is specified makes no difference. 

Are we correct in thinking that, as per the Sonatype docs, the
<goals><goal>compile</goal><goal>testCompiler</goal></goals> should work and
result in both compile and testCompiler MOJOs being properly configured?

Thanks,

John
-- 
View this message in context: http://www.nabble.com/Plugin-configuration-for-specific-goals---doc-error--tf4049555s177.html#a11502449
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Plugin configuration for specific goals - doc error?

Posted by jallen <jo...@hotmail.com>.
No change John, 'compile' MOJO gets properly configured 'testCompile' does
not. Out of interest I notice that, unlike the 'compile' MOJO the
'testCompile' MOJO execution does not get postfixed with the execution id:-

...
[DEBUG]   (f) target = 1.5
[DEBUG]   (f) verbose = false
[DEBUG] -- end configuration --
[INFO] [compiler:compile {execution: default}]
[DEBUG] Using compiler 'javac'.
[DEBUG] Source directories:
[D:\APT\projects\apt-metrics\apt-metrics-common\src\main\java]
....

-versus-

[DEBUG]   (f) showWarnings = false
[DEBUG]   (f) staleMillis = 0
[DEBUG]   (f) verbose = false
[DEBUG] -- end configuration --
[INFO] [compiler:testCompile]
[DEBUG] Using compiler 'javac'.
[DEBUG] Source directories:
[D:\APT\projects\apt-metrics\apt-metrics-common\src\test\java]

This was produced from a plugin configuration thus:

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<inherited>true</inherited>
					<executions>
						<execution>
							<id>default</id>
							<goals>
								<goal>compile</goal>
								<goal>testCompile</goal>
							</goals>
							<configuration>
								<source>1.5</source>
								<target>1.5</target>
							</configuration>
						</execution>
					</executions>
				</plugin>

Note, it does not seem to matter whether the configuration is attempted in
the <pluginsManagement> area or the <plugins> area.


cheers - John


John Casey-5 wrote:
> 
> Out of curiosity, does it make any difference if you specify  
> <id>default</id> in the plugin execution? It really shouldn't, but  
> those id's are used as a basis for merging configurations, so if it  
> were grabbing the wrong default value (or none at all), then merging  
> your plugin configuration with something given in, say, the super-pom  
> might get derailed...
> 
> I'll take a closer look at this, but it's something to check quickly...
> 
> -john
> 
> 
> On Jul 9, 2007, at 10:08 AM, jallen wrote:
> 
>>
>> Hi all,
>>
>> As per the rather excellent guide available at Sonatypes website
>> (http://www.sonatype.com/book/using-plugins.html#configuring_plugins):
>>
>> One is told that the following two compiler plugin configurations are
>> synonymous:
>>
>> <project>
>>   ...
>>   <build>
>>     <plugins>
>>       <plugin>
>>         <artifactId>maven-compiler-plugin</artifactId>
>>         <configuration>
>>           <source>1.4</source>
>>           <target>1.4</target>
>>         </configuration>
>>       </plugin>
>>
>> ..
>>
>> and
>>
>>
>> <project>
>>   ...
>>   <build>
>>     <plugins>
>>       <plugin>
>>         <artifactId>maven-compiler-plugin</artifactId>
>>         <executions>
>>           <execution>
>>             <goals>
>>               <goal>compile</goal>
>>               <goal>testCompile</goal>
>>             </goals>
>>             <configuration>
>>               <source>1.4</source>
>>               <target>1.4</target>
>>             </configuration>
>>           </execution>
>>         </executions>
>>       </plugin>
>>
>> However from a number of trials using compiler plugin version 2.0.2  
>> and
>> maven 2.0.7 we have been unable to get this to work.
>>
>> The global style plugin configuration works, with both Mojos  
>> getting the
>> correct configuration.
>> The Goal set based configuration properly configures the 'compile'  
>> goal but
>> does not configure the 'testCompile' goal.
>>
>> Varying where the testCompile goal is specified makes no difference.
>>
>> Are we correct in thinking that, as per the Sonatype docs, the
>> <goals><goal>compile</goal><goal>testCompiler</goal></goals> should  
>> work and
>> result in both compile and testCompiler MOJOs being properly  
>> configured?
>>
>> Thanks,
>>
>> John
>> -- 
>> View this message in context: http://www.nabble.com/Plugin- 
>> configuration-for-specific-goals---doc-error-- 
>> tf4049555s177.html#a11502449
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
> 
> ---
> John Casey
> Committer and PMC Member, Apache Maven
> mail: jdcasey at commonjava dot org
> blog: http://www.ejlife.net/blogs/john
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Plugin-configuration-for-specific-goals---doc-error--tf4049555s177.html#a11504591
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Plugin configuration for specific goals - doc error?

Posted by jallen <jo...@hotmail.com>.
Should I create a JIRA issue for this?

Thanks, John


John Casey-5 wrote:
> 
> Out of curiosity, does it make any difference if you specify  
> <id>default</id> in the plugin execution? It really shouldn't, but  
> those id's are used as a basis for merging configurations, so if it  
> were grabbing the wrong default value (or none at all), then merging  
> your plugin configuration with something given in, say, the super-pom  
> might get derailed...
> 
> I'll take a closer look at this, but it's something to check quickly...
> 
> -john
> 
> 
> On Jul 9, 2007, at 10:08 AM, jallen wrote:
> 
>>
>> Hi all,
>>
>> As per the rather excellent guide available at Sonatypes website
>> (http://www.sonatype.com/book/using-plugins.html#configuring_plugins):
>>
>> One is told that the following two compiler plugin configurations are
>> synonymous:
>>
>> <project>
>>   ...
>>   <build>
>>     <plugins>
>>       <plugin>
>>         <artifactId>maven-compiler-plugin</artifactId>
>>         <configuration>
>>           <source>1.4</source>
>>           <target>1.4</target>
>>         </configuration>
>>       </plugin>
>>
>> ..
>>
>> and
>>
>>
>> <project>
>>   ...
>>   <build>
>>     <plugins>
>>       <plugin>
>>         <artifactId>maven-compiler-plugin</artifactId>
>>         <executions>
>>           <execution>
>>             <goals>
>>               <goal>compile</goal>
>>               <goal>testCompile</goal>
>>             </goals>
>>             <configuration>
>>               <source>1.4</source>
>>               <target>1.4</target>
>>             </configuration>
>>           </execution>
>>         </executions>
>>       </plugin>
>>
>> However from a number of trials using compiler plugin version 2.0.2  
>> and
>> maven 2.0.7 we have been unable to get this to work.
>>
>> The global style plugin configuration works, with both Mojos  
>> getting the
>> correct configuration.
>> The Goal set based configuration properly configures the 'compile'  
>> goal but
>> does not configure the 'testCompile' goal.
>>
>> Varying where the testCompile goal is specified makes no difference.
>>
>> Are we correct in thinking that, as per the Sonatype docs, the
>> <goals><goal>compile</goal><goal>testCompiler</goal></goals> should  
>> work and
>> result in both compile and testCompiler MOJOs being properly  
>> configured?
>>
>> Thanks,
>>
>> John
>> -- 
>> View this message in context: http://www.nabble.com/Plugin- 
>> configuration-for-specific-goals---doc-error-- 
>> tf4049555s177.html#a11502449
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
> 
> ---
> John Casey
> Committer and PMC Member, Apache Maven
> mail: jdcasey at commonjava dot org
> blog: http://www.ejlife.net/blogs/john
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Plugin-configuration-for-specific-goals---doc-error--tf4049555s177.html#a11543601
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Plugin configuration for specific goals - doc error?

Posted by John Casey <jd...@commonjava.org>.
Out of curiosity, does it make any difference if you specify  
<id>default</id> in the plugin execution? It really shouldn't, but  
those id's are used as a basis for merging configurations, so if it  
were grabbing the wrong default value (or none at all), then merging  
your plugin configuration with something given in, say, the super-pom  
might get derailed...

I'll take a closer look at this, but it's something to check quickly...

-john


On Jul 9, 2007, at 10:08 AM, jallen wrote:

>
> Hi all,
>
> As per the rather excellent guide available at Sonatypes website
> (http://www.sonatype.com/book/using-plugins.html#configuring_plugins):
>
> One is told that the following two compiler plugin configurations are
> synonymous:
>
> <project>
>   ...
>   <build>
>     <plugins>
>       <plugin>
>         <artifactId>maven-compiler-plugin</artifactId>
>         <configuration>
>           <source>1.4</source>
>           <target>1.4</target>
>         </configuration>
>       </plugin>
>
> ..
>
> and
>
>
> <project>
>   ...
>   <build>
>     <plugins>
>       <plugin>
>         <artifactId>maven-compiler-plugin</artifactId>
>         <executions>
>           <execution>
>             <goals>
>               <goal>compile</goal>
>               <goal>testCompile</goal>
>             </goals>
>             <configuration>
>               <source>1.4</source>
>               <target>1.4</target>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>
> However from a number of trials using compiler plugin version 2.0.2  
> and
> maven 2.0.7 we have been unable to get this to work.
>
> The global style plugin configuration works, with both Mojos  
> getting the
> correct configuration.
> The Goal set based configuration properly configures the 'compile'  
> goal but
> does not configure the 'testCompile' goal.
>
> Varying where the testCompile goal is specified makes no difference.
>
> Are we correct in thinking that, as per the Sonatype docs, the
> <goals><goal>compile</goal><goal>testCompiler</goal></goals> should  
> work and
> result in both compile and testCompiler MOJOs being properly  
> configured?
>
> Thanks,
>
> John
> -- 
> View this message in context: http://www.nabble.com/Plugin- 
> configuration-for-specific-goals---doc-error-- 
> tf4049555s177.html#a11502449
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---
John Casey
Committer and PMC Member, Apache Maven
mail: jdcasey at commonjava dot org
blog: http://www.ejlife.net/blogs/john



Re: Plugin configuration for specific goals - doc error?

Posted by John Casey <jd...@commonjava.org>.
Hi, sorry it's taken so long for me to respond.

I was able to replicate your difficulty on this end of things, and  
what I've found is that the Sonatype document is incorrect about  
these two being interchangeable. They _should_ be, but are not...at  
least, not in the 2.0.x releases. I would have sworn that we had a  
test for this at one point, and I'm pretty sure it worked  
before...but I've tried back to 2.0.4, and had no luck. One thing I  
will say is that it works just fine in maven 2.1-snapshot (the  
current trunk), but I know that without at least an alpha release,  
this is just an academic point.

If you feel like doing it, can you make sure this is captured in a  
JIRA issue? If you don't have time, I can add it myself. I'll also  
look at correcting (or at least footnoting) the Sonatype document.

Thanks,

John


On Jul 9, 2007, at 10:08 AM, jallen wrote:

>
> Hi all,
>
> As per the rather excellent guide available at Sonatypes website
> (http://www.sonatype.com/book/using-plugins.html#configuring_plugins):
>
> One is told that the following two compiler plugin configurations are
> synonymous:
>
> <project>
>   ...
>   <build>
>     <plugins>
>       <plugin>
>         <artifactId>maven-compiler-plugin</artifactId>
>         <configuration>
>           <source>1.4</source>
>           <target>1.4</target>
>         </configuration>
>       </plugin>
>
> ..
>
> and
>
>
> <project>
>   ...
>   <build>
>     <plugins>
>       <plugin>
>         <artifactId>maven-compiler-plugin</artifactId>
>         <executions>
>           <execution>
>             <goals>
>               <goal>compile</goal>
>               <goal>testCompile</goal>
>             </goals>
>             <configuration>
>               <source>1.4</source>
>               <target>1.4</target>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>
> However from a number of trials using compiler plugin version 2.0.2  
> and
> maven 2.0.7 we have been unable to get this to work.
>
> The global style plugin configuration works, with both Mojos  
> getting the
> correct configuration.
> The Goal set based configuration properly configures the 'compile'  
> goal but
> does not configure the 'testCompile' goal.
>
> Varying where the testCompile goal is specified makes no difference.
>
> Are we correct in thinking that, as per the Sonatype docs, the
> <goals><goal>compile</goal><goal>testCompiler</goal></goals> should  
> work and
> result in both compile and testCompiler MOJOs being properly  
> configured?
>
> Thanks,
>
> John
> -- 
> View this message in context: http://www.nabble.com/Plugin- 
> configuration-for-specific-goals---doc-error-- 
> tf4049555s177.html#a11502449
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---
John Casey
Committer and PMC Member, Apache Maven
mail: jdcasey at commonjava dot org
blog: http://www.ejlife.net/blogs/john