Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Replacing token in WAR web.xml from EAR pom.xml

$
0
0
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>

Viewing all articles
Browse latest Browse all 5648

Trending Articles