Hi, 

We would like to invoke different goals on 1 plugin. 

>From reading the documentation, it seems that the best way to achieve this
is to setup a profile and specify the same plugin but with a different goal. 

Here is the 1st time that the plugin is defined in the pom.xml. Take note of
the goal in this scenario 'check' (This should execute by default) 

<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-pmd-plugin</artifactId>
    <version>2.4</version>
    <executions>
      <execution>
        <phase>generate-sources</phase>
        <goals>
          <goal>check</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>
</build>

And now for the profile, the goal in this case is 'pmd' : 

<profiles>
<profile>
  <id>sonar</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>pmd</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>
</profiles>

(Side note : We have to execute it during the generate-sources phase as we
have other plugins that alters the source and any other phase is too late
for this plugin in our environment)

However, this approach seems to ONLY be valid for the top level. Once it
decends into the child projects, then it seems to merge the goals, 'check'
first & 'pmd' thereafter (which doesn't seem to work correctly - see
http://jira.codehaus.org/browse/MNG-4022). The documentation does mention
that stuff will be merged but it fails to mention a.) is it possible to get
around it? and b.) if it is possible, how would one go about it.

We had a look into execution id's as well, but it seems that they are only
bound to a lifecycle and cannot be used in our scenario. 

Any help would be much appreciated, 

-- izak









-- 
View this message in context: 
http://n2.nabble.com/How-to-Invoke-different-goals-of-1-plugin-tp4755892p4755892.html
Sent from the maven users mailing list archive at Nabble.com.

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

Reply via email to