I managed to make it work with the assembly plugin. Maybe not a state
of the art maven konfiguration, but it seems to work :)

This produces three war-files. The original which I won't be using
anymore, and two additional war files with the extension int and ext.

added this to the pom:
<plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
                <execution>
                        <id>make-assembly-external</id>
                        <configuration>
                                <descriptors>
                                        
<descriptor>assembly-descriptor-external.xml</descriptor>
                                </descriptors>
                        </configuration>
                        <phase>package</phase>
                        <goals>
                                <goal>attached</goal>
                        </goals>
                </execution>
                <execution>
                        <id>make-assembly-internal</id>
                        <configuration>
                                <descriptors>
                                        
<descriptor>assembly-descriptor-internal.xml</descriptor>
                                </descriptors>
                        </configuration>
                        <phase>package</phase>
                        <goals>
                                <goal>attached</goal>
                        </goals>
                </execution>
        </executions>
</plugin>

and this is the assembly-descriptor-external.xml:
<assembly
        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/
1.1.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-
plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd";>
        <id>ext</id>
        <includeBaseDirectory>false</includeBaseDirectory>
        <formats>
                <format>war</format>
        </formats>
        <fileSets>
                <fileSet>
                        
<directory>../${project.artifactId}/target/${project.artifactId}-$
{project.version}/</directory>
                        <includes>
                                <include>**</include>
                        </includes>
                        <excludes>
                                <exclude>WEB-INF/web.xml</exclude>
                        </excludes>
                        <outputDirectory>/</outputDirectory>
                </fileSet>
        </fileSets>
        <files>
                <file>
                        
<source>../${project.artifactId}/src/main/web/ext/web.xml</source>
                        <outputDirectory>/WEB-INF</outputDirectory>
                </file>
        </files>
</assembly>


On 12 Aug, 20:17, "dane.molotok" <[email protected]> wrote:
> Have you thought about using themaven-assembly-plugin to generate a
> secondary end-state? Just an idea.
>
> On Aug 12, 6:23 am, Stephan T <[email protected]> wrote:
>
> > I need to build two war files with different web.xml files becuase of
> > different servlet filter configurations depending on which server it
> > will be deployed on.
>
> > It will be deployed on two server simultaneously. I'd rather build two
> > war files during one build, because that will always be the scenario.
> > Feels a bit quirky to fiddle with profiles etc.
>
> > I have successfully managed to get something similar working when
> > building another artifact in the project using "executions", but that
> > artifact is a jar, and I can't seem to get this to work with themaven
> > war plugin.
>
> > This is the error I get now::
> > Error assembling WAR: Deployment descriptor: W:\trunk\web\target
> > \web-2.2.4-SNAPSHOT\WEB-INF\web.xml does not exist.
>
> > And this is a snippet from my pom.xml which produces the error:
> >   <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-war-plugin</artifactId>
> >         <executions>
> >                 <execution>
> >                         <id>package-int</id>
> >                         <phase>package</phase>
> >                         <goals>
> >                                 <goal>war</goal>
> >                         </goals>
> >                         <configuration>
> >                                 <warSourceDirectory>war</warSourceDirectory>
> >                                 <webXml>war/WEB-INF/web.xml</webXml>
> >                         </configuration>
> >                 </execution>
> >                 <execution>
> >                         <id>package-ext</id>
> >                         <phase>package</phase>
> >                         <goals>
> >                                 <goal>war</goal>
> >                         </goals>
> >                         <configuration>
> >                                 <warSourceDirectory>war</warSourceDirectory>
> >                                 <webXml>src/main/web/ext/web.xml</webXml>
> >                         </configuration>
> >                 </execution>
> >     </executions>
> >   </plugin>
>
> > I also realize that this hasn't got anything with GWT to do :) But
> > since this mail list is heavy on webapp/java knowledgable people and
> >mavenis often used to build these kind of products, I guess someone
> > might know...
>
> >  // S
>
> > On 6 Aug, 19:14, andreas <[email protected]> wrote:
>
> > > I don't think you can do that in one build.
>
> > > But you can use profiles to have two different builds. Of course you
> > > will have to build twice, once for each profile but with that you'll
> > > have the different builds. I use profiles to run hosted_mode target
> > > with fake service servlet implementations and web.xml with appropriate
> > > mapping and no security constraints. The normal build will use the
> > > deploy web.xml with real servlet mapped and security constraints.
>
> > > For me this works pretty good and you will not have to alter files
> > > (especially pom.xml) for this or that and hence get messy conflicts
> > > with your version system.
>
> > > Regards,
>
> > > Andreas
>
> > > On 6 Aug., 19:02, "dane.molotok" <[email protected]> wrote:
>
> > > > I've thought about doing that also, in order to to have a war where
> > > > my .gwt.xml inherits the Debug module, and one that does not, but I'm
> > > > beginning to think it's not even buying me much to find out how to do
> > > > it. I'm assuming you have a similar reason for wanting to do this?
>
> > > > On Aug 6, 3:57 am, Stephan T <[email protected]> wrote:
>
> > > > > I'm using the GWT-plugin forMavento build my application. I want to
> > > > > build two war-files where the only difference is that I want to use a
> > > > > different web.xml.
>
> > > > > How do I achieve that?
>
> > > > > Here's my pom.xml:
> > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > <project xmlns="http://maven.apache.org/POM/4.0.0"; 
> > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > > > >         
> > > > > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0...";>
> > > > >         <modelVersion>4.0.0</modelVersion>
>
> > > > >         <name>Web Application</name>
> > > > >         <groupId>my.company</groupId>
> > > > >         <artifactId>web</artifactId>
> > > > >         <version>${web-version}</version>
> > > > >         <packaging>war</packaging>
>
> > > > >         <parent>
> > > > >                 <groupId>my.company</groupId>
> > > > >                 <artifactId>build</artifactId>
> > > > >                 <version>${version}</version>
> > > > >                 <relativePath>../build/pom.xml</relativePath>
> > > > >         </parent>
>
> > > > >         <build>
> > > > >                 <outputDirectory>war/WEB-INF/classes</outputDirectory>
> > > > >                 <plugins>
> > > > >                         <plugin>
> > > > >                                 <groupId>org.codehaus.mojo</groupId>
> > > > >                                 
> > > > > <artifactId>gwt-maven-plugin</artifactId>
> > > > >                                 <executions>
> > > > >                                         <execution>
> > > > >                                                 <goals>
> > > > >                                                         
> > > > > <goal>compile</goal>
> > > > >                                                         
> > > > > <!--<goal>generateAsync</goal>-->
> > > > >                                                         
> > > > > <goal>test</goal>
> > > > >                                                 </goals>
> > > > >                                         </execution>
> > > > >                                 </executions>
> > > > >                         </plugin>
> > > > >                         <plugin>
> > > > >                                 
> > > > > <groupId>org.apache.maven.plugins</groupId>
> > > > >                                 
> > > > > <artifactId>maven-war-plugin</artifactId>
> > > > >                                 <configuration>
> > > > >                                         
> > > > > <warSourceDirectory>war</warSourceDirectory>
> > > > >                                         
> > > > > <webXml>war/WEB-INF/web.xml</webXml>
> > > > >                                 </configuration>
> > > > >                         </plugin>
> > > > >                 </plugins>
> > > > >         </build>
>
> > > > >         <dependencies>
> > > > >                 <dependency>
> > > > >                         <groupId>my.company</groupId>
> > > > >                         <artifactId>env-configuration</artifactId>
> > > > >                         
> > > > > <version>${env-configuration-version}</version>
> > > > >                         <type>jar</type>
> > > > >                         <scope>provided</scope>
> > > > >                 </dependency>
> > > > >                 <dependency>
> > > > >                         <groupId>my.company</groupId>
> > > > >                         <artifactId>common</artifactId>
> > > > >                         <version>${common-version}</version>
> > > > >                         <type>jar</type>
> > > > >                 </dependency>
> > > > >                 <dependency>
> > > > >                         <groupId>com.google.gwt</groupId>
> > > > >                         <artifactId>gwt-servlet</artifactId>
> > > > >                 </dependency>
> > > > >                 <dependency>
> > > > >                         <groupId>com.google.gwt</groupId>
> > > > >                         <artifactId>gwt-user</artifactId>
> > > > >                 </dependency>
> > > > >                 <dependency>
> > > > >                         <groupId>com.google.gwt</groupId>
> > > > >                         <artifactId>gwt-incubator</artifactId>
> > > > >                 </dependency>
> > > > >                 <dependency>
> > > > >                         
> > > > > <groupId>org.springframework.security</groupId>
> > > > >                         
> > > > > <artifactId>spring-security-taglibs</artifactId>
> > > > >                 </dependency>
> > > > >                 <dependency>
> > > > >                         
> > > > > <groupId>org.springframework.security</groupId>
> > > > >                         
> > > > > <artifactId>spring-security-config</artifactId>
> > > > >                 </dependency>
> > > > >                 <dependency>
> > > > >                         
> > > > > <groupId>org.springframework.security</groupId>
> > > > >                         <artifactId>spring-security-web</artifactId>
> > > > >                 </dependency>
> > > > >                 <dependency>
> > > > >                         <groupId>jstl</groupId>
> > > > >                         <artifactId>jstl</artifactId>
> > > > >                 </dependency>
> > > > >      
>
> ...
>
> läs mer »

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to