Certainly not ideal.  I'm very surprised that maven doesn't profile finer
grained phases.  If there a way to have my EAR pom set a property that is
shared by it's dependencies?  Perhaps I can then filter the web project
with such a global property.

On Mon, Sep 22, 2014 at 3:12 AM, Anders Hammar <[email protected]> wrote:

> 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 <[email protected]>
> 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>
> >
>



-- 
“If the American people ever allow private banks to control the issue of
their currency, first by inflation, then by deflation, the banks...will
deprive the people of all property until their children wake-up homeless on
the continent their fathers conquered... The issuing power should be taken
from the banks and restored to the people, to whom it properly belongs."
-- Thomas Jefferson

"Government big enough to supply everything...is big enough to take
everything you have. The course of history shows that as a government
grows, liberty decreases" --- Thomas Jefferson

www.CampaignForLiberty.org

Reply via email to