maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Hammar <and...@hammar.net>
Subject Re: Replacing token in WAR web.xml from EAR pom.xml
Date Mon, 22 Sep 2014 07:12:51 GMT
The solution that comes to my mind is to have one common war module and
then use war overlays and create separat war modules for each "flavor" of
the webapp you need (one for each ear I guess). It means many modules
unfortunately, but is somewhat the Maven way.

Google on "maven war overlay" for more info.

/Anders

On Sat, Sep 20, 2014 at 5:16 AM, Grover Blue <grover.blue@gmail.com> wrote:

> Hello,  I'm new to maven, and trying to navigate all the plugins and
> syntax.  Forgive me if this has been asked previously, but I can't seem to
> things to work.
>
> I have a root/parent project that contains several EAR projects, all which
> use the same WAR project.  I need to customize the contents of web.xml for
> each EAR build/package.  I'm not clear on the steps to do this.  I tried
> copying my ANT script over to the pom, but even though I could update the
> copied web.war, it never carries over to the final *.ear package.
>
> Here is what I'm attempting (shortcut.targetFull and realmName are defined
> properties in this pom):
>
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-antrun-plugin</artifactId>
>                 <version>1.7</version>
>                 <executions>
>
>
>
>
>
> *<execution>
> <id>rename-realm</id>
> <phase></phase>
> <configuration>
> <target>                                <unzip
> src="${shortcut.targetFull}/web-${project.version}.war" dest="${*
> *shortcut.targetFull}/web"/>                                <replace
> file="${*
> *shortcut.targetFull}/web/WEB-INF/web.xml" token="@REALM_NAME@"
> value="${realmName}"/>                                <delete file="${*
> *shortcut.targetFull}/web-${project.version}.war"/>
> <zip destfile="${**shortcut.targetFull}/web-${project.version}.war"
> basedir="${*
> *shortcut.targetFull}/web" />                                <delete
> dir="${*
>
>
>
>
>
> *shortcut.targetFull}/web" />
> </target>                        </configuration>
> <goals>
> <goal>run</goal>
> </goals>                    </execution>*
>                     <execution>
>                         <id>rename-package</id>
>                         <phase></phase>
>                         <configuration>
>                             <target>
>                                 <tstamp>
>                                     <format property="TODAY_BUILD"
> pattern="yyyyMMdd-HHmmss"  locale="en,US"/>
>                                 </tstamp>
>                                 <copy
> file="${project.build.directory}/${project.build.finalName}.ear"
> tofile="${project.build.directory}/${project.name
> }-${project.version}-${TODAY_BUILD}.ear"/>
>                             </target>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>3.1</version>
>                 <configuration>
>                     <source>1.7</source>
>                     <target>1.7</target>
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-ear-plugin</artifactId>
>                 <version>2.9</version>
>                 <configuration>
>                     <version>6</version>
>                     <defaultLibBundleDir>lib</defaultLibBundleDir>
>                     <displayName>myweb</displayName>
>                     <initializeInOrder>true</initializeInOrder>
>                     <modules>
>                         <jarModule>
>                             <groupId>${project.groupId}</groupId>
>                             <artifactId>lib1</artifactId>
>
> <includeInApplicationXml>false</includeInApplicationXml>
>                         </jarModule>
>                         <ejbModule>
>                             <groupId>${project.groupId}</groupId>
>                             <artifactId>ejb1</artifactId>
>                         </ejbModule>
>                         <webModule>
>                             <groupId>${project.groupId}</groupId>
>                             <artifactId>web</artifactId>
>                             <contextRoot>/myweb</contextRoot>
>                         </webModule>
>                     </modules>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message