You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by SkipWalker <sk...@skipwalker.com> on 2006/07/03 23:54:40 UTC

war plugin 2.0.1 webResources pom.* filtering

So my basic question is, how do I get some of my webapp files in my war
project to be filtered with my pom.version value?  I've done what I think I
need to do, but the build appears to be executing the plugin twice or
something, creating errors.  There some configuration tweak that I can't
figure out to get this to work.  

So here's what I have.

I have a war project in my maven 2.0.4 multi-project build.

I have a few files in src/main/webapp that I need to filter in the
${pom.version} value.  

This apparently was a bug with version 2.0 of the plugin ( see bug 
http://jira.codehaus.org/browse/MWAR-41 ).
Hemce, I changed my version to the recently released 2.0.1.

Also, see this  thread .

So, I modified my pom.xml to use to use the 2.0.1 plugin via the following
configuration.
         <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>                
                <version>2.0.1</version>
                         
                        <configuration>                               
                            <!-- we need to filter the resources so the
correct version gets into the jsp links -->
                            <webResources>
                                <resource>
                                   
<directory>${basedir}/src/main/webapp</directory>
                                    <filtering>true</filtering>
                                    <includes>
                                        <include>**/web.xml</include>
                                        <include>**/context.xml</include>
                                        <include>**/*.jsp</include>
                                    </includes>
                                </resource>
                            </webResources>                
                            <archive>
                                <manifestEntries>
                                    <Implementation-Build>${pom.version}
(r${buildNumber})</Implementation-Build>
                                </manifestEntries>
                            </archive>
                        </configuration>
                   
            </plugin>


This appears to work sort of.  In the build it appears to be doing the
webResource filtering twice.  This wouldn't be so bad, but it causes in
error when the thing tries to set the Implementation-Build the second time
it does the copy.

Here's a snippet of the build output.  It says the webResources are being
copied, and then the next line it says the webResources are being copied
again.  This appears to be the reason why it fails.  Something is causing
the build to try and produce the manifest twice.

[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-war-plugin:2.0.1:war' -->
[DEBUG]   (f) manifestEntries = {Implementation-Build=1.0-BETA (r1956)}
[DEBUG]   (f) archive =
org.apache.maven.archiver.MavenArchiveConfiguration@c92507
[DEBUG]   (f) archiveClasses = false
[DEBUG]   (s) classesDirectory =
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\classes
[DEBUG]   (f) filters = []
[DEBUG]   (f) outputDirectory =
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target
[DEBUG]   (f) primaryArtifact = true
[DEBUG]   (s) project = org.apache.maven.project.MavenProject@2508a832
[DEBUG]   (f) warName = mywebapp-1.0-BETA
[DEBUG]   (s) warSourceDirectory =
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\src\main\webapp
[DEBUG]   (s) directory =
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www/src/main/webapp
[DEBUG]   (s) filtering = true
[DEBUG]   (s) includes = [**/web.xml, **/context.xml, **/*.jsp]
[DEBUG]   (f) webResources = [Lorg.apache.maven.model.Resource;@1dfd868
[DEBUG]   (s) webappDirectory =
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
[DEBUG]   (f) workDirectory =
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\war\work
[DEBUG] -- end configuration --
[INFO] [war:war]
[INFO] Exploding webapp...
[INFO] Copy webapp webResources to
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
[INFO] Copy webapp webResources to
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
[INFO] Assembling webapp www in
C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA

...
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error assembling WAR

Embedded error: The attribute "Implementation-Build" may not occur more than
once in the same section
[INFO]
------------------------------------------------------------------------



-- 
View this message in context: http://www.nabble.com/war-plugin-2.0.1-webResources-pom.*-filtering-tf1886910.html#a5158779
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: war plugin 2.0.1 webResources pom.* filtering

Posted by franz see <fr...@gmail.com>.


SkipWalker wrote:
> 
> So my basic question is, how do I get some of my webapp files in my war
> project to be filtered with my pom.version value?  I've done what I think
> I need to do, but the build appears to be executing the plugin twice or
> something, creating errors.  There some configuration tweak that I can't
> figure out to get this to work.  
> 
> So here's what I have.
> 
> I have a war project in my maven 2.0.4 multi-project build.
> 
> I have a few files in src/main/webapp that I need to filter in the
> ${pom.version} value.  
> 
> This apparently was a bug with version 2.0 of the plugin ( see bug 
> http://jira.codehaus.org/browse/MWAR-41
> http://jira.codehaus.org/browse/MWAR-41 ).
> Hemce, I changed my version to the recently released 2.0.1.
> 
> Also, see this 
> http://www.nabble.com/War-plugin-and-filtering-webapp-files-t1617964.html
> thread .
> 
> So, I modified my pom.xml to use to use the 2.0.1 plugin via the following
> configuration.
>          <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-war-plugin</artifactId>                
>                 <version>2.0.1</version>
>                          
>                         <configuration>                               
>                             <!-- we need to filter the resources so the
> correct version gets into the jsp links -->
>                             <webResources>
>                                 <resource>
>                                    
> <directory>${basedir}/src/main/webapp</directory>
>                                     <filtering>true</filtering>
>                                     <includes>
>                                         <include>**/web.xml</include>
>                                         <include>**/context.xml</include>
>                                         <include>**/*.jsp</include>
>                                     </includes>
>                                 </resource>
>                             </webResources>                
>                             <archive>
>                                 <manifestEntries>
>                                     <Implementation-Build>${pom.version}
> (r${buildNumber})</Implementation-Build>
>                                 </manifestEntries>
>                             </archive>
>                         </configuration>
>                    
>             </plugin>
> 
> 
> This appears to work sort of.  In the build it appears to be doing the
> webResource filtering twice.  This wouldn't be so bad, but it causes in
> error when the thing tries to set the Implementation-Build the second time
> it does the copy.
> 
> Here's a snippet of the build output.  It says the webResources are being
> copied, and then the next line it says the webResources are being copied
> again.  This appears to be the reason why it fails.  Something is causing
> the build to try and produce the manifest twice.
> 
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-war-plugin:2.0.1:war' -->
> [DEBUG]   (f) manifestEntries = {Implementation-Build=1.0-BETA (r1956)}
> [DEBUG]   (f) archive =
> org.apache.maven.archiver.MavenArchiveConfiguration@c92507
> [DEBUG]   (f) archiveClasses = false
> [DEBUG]   (s) classesDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\classes
> [DEBUG]   (f) filters = []
> [DEBUG]   (f) outputDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target
> [DEBUG]   (f) primaryArtifact = true
> [DEBUG]   (s) project = org.apache.maven.project.MavenProject@2508a832
> [DEBUG]   (f) warName = mywebapp-1.0-BETA
> [DEBUG]   (s) warSourceDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\src\main\webapp
> [DEBUG]   (s) directory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www/src/main/webapp
> [DEBUG]   (s) filtering = true
> [DEBUG]   (s) includes = [**/web.xml, **/context.xml, **/*.jsp]
> [DEBUG]   (f) webResources = [Lorg.apache.maven.model.Resource;@1dfd868
> [DEBUG]   (s) webappDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
> [DEBUG]   (f) workDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\war\work
> [DEBUG] -- end configuration --
> [INFO] [war:war]
> [INFO] Exploding webapp...
> [INFO] Copy webapp webResources to
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
> [INFO] Copy webapp webResources to
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
> [INFO] Assembling webapp www in
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
> 
> ...
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error assembling WAR
> 
> Embedded error: The attribute "Implementation-Build" may not occur more
> than once in the same section
> [INFO]
> ------------------------------------------------------------------------
> 
> 
> 
> 

Good day to you, SkipWalker,

Regarding the filtering:
Try adding a filter property fiile to your configuration. Even if that file
is empty. If you're filtering suddenly works, then it's the bug addressed by
[1]. If so, you may want to download the patch and apply it to your
maven-war-plugin, and install it again (the patch has not yet been applied). 

Regarding the mutliple copying of webResources:
Do not be alarmed by that. It's supposed to be that way. It's simply telling
you where a webResources fileset are copied, but not actually telling you
which among the webResoures are being copied. In fact, if you have to be
alarmed at something, is that it's only copying TWO webResources filest,
although you indicated three! But then again, that's an unrelated issue to
your filtering problem (since your filtering problem is that you can't
filter the file, and not that the file to be filtered is not copied). 

Cheers,
Franz

[1] http://jira.codehaus.org/browse/MWAR-67

-- 
View this message in context: http://www.nabble.com/war-plugin-2.0.1-webResources-pom.*-filtering-tf1886910.html#a6445292
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: war plugin 2.0.1 webResources pom.* filtering

Posted by Pete <pe...@gmail.com>.
Did anyone get a resolution to this ?

I'm getting exactly the same error.  Only solution I could find was
going back to version 2.0 of war plugin

On 03/07/06, SkipWalker <sk...@skipwalker.com> wrote:
>
> So my basic question is, how do I get some of my webapp files in my war
> project to be filtered with my pom.version value?  I've done what I think I
> need to do, but the build appears to be executing the plugin twice or
> something, creating errors.  There some configuration tweak that I can't
> figure out to get this to work.
>
> So here's what I have.
>
> I have a war project in my maven 2.0.4 multi-project build.
>
> I have a few files in src/main/webapp that I need to filter in the
> ${pom.version} value.
>
> This apparently was a bug with version 2.0 of the plugin ( see bug
> http://jira.codehaus.org/browse/MWAR-41 ).
> Hemce, I changed my version to the recently released 2.0.1.
>
> Also, see this  thread .
>
> So, I modified my pom.xml to use to use the 2.0.1 plugin via the following
> configuration.
>          <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-war-plugin</artifactId>
>                 <version>2.0.1</version>
>
>                         <configuration>
>                             <!-- we need to filter the resources so the
> correct version gets into the jsp links -->
>                             <webResources>
>                                 <resource>
>
> <directory>${basedir}/src/main/webapp</directory>
>                                     <filtering>true</filtering>
>                                     <includes>
>                                         <include>**/web.xml</include>
>                                         <include>**/context.xml</include>
>                                         <include>**/*.jsp</include>
>                                     </includes>
>                                 </resource>
>                             </webResources>
>                             <archive>
>                                 <manifestEntries>
>                                     <Implementation-Build>${pom.version}
> (r${buildNumber})</Implementation-Build>
>                                 </manifestEntries>
>                             </archive>
>                         </configuration>
>
>             </plugin>
>
>
> This appears to work sort of.  In the build it appears to be doing the
> webResource filtering twice.  This wouldn't be so bad, but it causes in
> error when the thing tries to set the Implementation-Build the second time
> it does the copy.
>
> Here's a snippet of the build output.  It says the webResources are being
> copied, and then the next line it says the webResources are being copied
> again.  This appears to be the reason why it fails.  Something is causing
> the build to try and produce the manifest twice.
>
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-war-plugin:2.0.1:war' -->
> [DEBUG]   (f) manifestEntries = {Implementation-Build=1.0-BETA (r1956)}
> [DEBUG]   (f) archive =
> org.apache.maven.archiver.MavenArchiveConfiguration@c92507
> [DEBUG]   (f) archiveClasses = false
> [DEBUG]   (s) classesDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\classes
> [DEBUG]   (f) filters = []
> [DEBUG]   (f) outputDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target
> [DEBUG]   (f) primaryArtifact = true
> [DEBUG]   (s) project = org.apache.maven.project.MavenProject@2508a832
> [DEBUG]   (f) warName = mywebapp-1.0-BETA
> [DEBUG]   (s) warSourceDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\src\main\webapp
> [DEBUG]   (s) directory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www/src/main/webapp
> [DEBUG]   (s) filtering = true
> [DEBUG]   (s) includes = [**/web.xml, **/context.xml, **/*.jsp]
> [DEBUG]   (f) webResources = [Lorg.apache.maven.model.Resource;@1dfd868
> [DEBUG]   (s) webappDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
> [DEBUG]   (f) workDirectory =
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\war\work
> [DEBUG] -- end configuration --
> [INFO] [war:war]
> [INFO] Exploding webapp...
> [INFO] Copy webapp webResources to
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
> [INFO] Copy webapp webResources to
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
> [INFO] Assembling webapp www in
> C:\Builds\mywebapp\manual\work\branches\checkout\30Jun06-1.0beta\www\target\mywebapp-1.0-BETA
>
> ...
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error assembling WAR
>
> Embedded error: The attribute "Implementation-Build" may not occur more than
> once in the same section
> [INFO]
> ------------------------------------------------------------------------
>
>
>
> --
> View this message in context: http://www.nabble.com/war-plugin-2.0.1-webResources-pom.*-filtering-tf1886910.html#a5158779
> Sent from the Maven - Users forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org