You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Giovanni Azua <br...@swissonline.ch> on 2007/06/27 08:55:07 UTC

conditional reporting ...

Hi all,

 

I build the site of my project whether from Windows or Fedora, svn does not
work

Correctly on windows so I wanted to activate the SCM report plugin only on
demand

e.g.

 

mvn clean install site -Dgenerate.statsvn=true

 

The problem is that I can not find the way to specify this in my pom.xml I
tried this bellow

Without success e.g.

 

<reporting>

  <plugins>

    <j:if test="${context.getVariable('generate.scm')=='true'}">

       <ant:echo>Generating StatSVN report using stat-scm</ant:echo>

       <plugin>

          <groupId>net.sf</groupId>

          <artifactId>stat-scm</artifactId>

       </plugin>

    </j:if>

  </plugins>

</reporting>

 

That way does not work.

 

TIA,

Regards,

Giovanni


Re: conditional reporting ...

Posted by Steven Rowe <sa...@syr.edu>.
Hi Giovanni,

Giovanni Azua wrote:
> ... I wanted to activate the SCM report plugin only on demand
> 
> e.g.
> 
> mvn clean install site -Dgenerate.statsvn=true

...

> <reporting>
>   <plugins>
>     <j:if test="${context.getVariable('generate.scm')=='true'}">
>       <ant:echo>Generating StatSVN report using stat-scm</ant:echo>

First off, you're attempting to use Jelly scripting in a Maven 2 POM,
and sir, this will not stand.  Since the advent of Maven 2, Jelly is no
longer supported in the POM.  Declarative syntax only.  Well, except for
embedded Ant scripts via maven-antrun-plugin[1] executions.

Anyway, there is a standard M2 way to do what you want: wrap the
reporting plugin configuration in a profile[2], and activate the profile
based on the value of a property, something like:

<project>
  ...
  <profiles>
    <profile>
      <activation>
        <property><name>generate.statsvn</name></property>
      </activation>
      <reporting>
        <plugin>
          <groupId>net.sf</groupId>
          <artifactId>stat-scm</artifactId>
        </plugin>
      </reporting>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <phase>pre-site</phase>
                <goals><goal>run</goal></goals>
                <configuration>
                  <tasks>
                    <echo>Generating StatSVN report using stat-scm</echo>
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  ...
</project>


Steve

[1] http://maven.apache.org/plugins/maven-antrun-plugin
[2]
http://maven.apache.org/guides/introduction/introduction-to-profiles.html

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