[ http://jira.codehaus.org/browse/MWAR-86?page=all ]

Simone Gianni updated MWAR-86:
------------------------------

    Attachment: maven-war-plugin1.diff

I parametrized the WarMojo with two booleans, one to create the folder 
structure, the other one to create the war file.

Then I created a new mojo, WarOnlyMojo, goal war-package, that subclasses 
WarMojo setting only the boolean needed to produce the war file.

This way, it's possible to act this way in a project pom.xml :

      <!-- Default execution of war plugin, without war file generation -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2-SNAPSHOT</version>
        <configuration>
          <doCreateWarFile>false</doCreateWarFile>
        </configuration>
      </plugin>
      <!-- Execute any other plugin, binding it to the package phase -->
      <plugin>
        <groupId>xpatch</groupId>
        <artifactId>xpatch-maven-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>xpatch</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Execute the war-package goal and create the war file -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2-SNAPSHOT</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>war-package</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

Unfortunately I found no way to "merge" the two war plugin declarations in a 
single one, since :
- Declaring two executions makes the plugin execute 3 time, once with the 
default way, and the other two with the customized configuration.
- Declaring the configuration together with the executions, makes the plugin 
ignore the default configuration and execute once as normal, and then with the 
war-package goal.

Anyway with this it's already possible to change the cocoon-deployer-plugin so 
that it does not extend the war mojo, does not suffer from the NPE caused more 
or less from what's described here 
http://www.mail-archive.com/dev@maven.apache.org/msg60770.html, and makes it 
possible to stack multiple plugins to work on a war before it's compressed to a 
single file.

> Split the WAR file creation as a separate goal
> ----------------------------------------------
>
>                 Key: MWAR-86
>                 URL: http://jira.codehaus.org/browse/MWAR-86
>             Project: Maven 2.x War Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.0, 2.0.1, 2.0.2
>            Reporter: Simone Gianni
>            Priority: Minor
>         Attachments: maven-war-plugin1.diff
>
>
> It would be nice to have a separate goal that zips the WAR file. This way it 
> will be possible to write (and use) plugins that manipulates the WAR folder 
> before the WAR file is built (like applying patches, reorganizing site 
> structure and similar stuff).
> Also, there are some plugins (like the cocoon deploy plugin) that actually 
> extend the war plugin to operate "in the middle". This could be avoided 
> (IIUC) adding these separate goal in the WAR plugin.
> It should be quite trivial to do, I volunteer for trying.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to