You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Dennis Lundberg (Jira)" <ji...@apache.org> on 2022/04/20 10:44:00 UTC

[jira] [Comment Edited] (MWAR-440) When it is necessary to build more than one WAR archive at the same time, it fails to set different web.xml

    [ https://issues.apache.org/jira/browse/MWAR-440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17524872#comment-17524872 ] 

Dennis Lundberg edited comment on MWAR-440 at 4/20/22 10:43 AM:
----------------------------------------------------------------

The reason for this seems to be that the time stamp of the two web.xml files are identical.

In the first run the war plugin copies files into target/mwar-bug-example/WEB-INF/ including web1.xml.

During the second run the war plugin copies files into target/mwar-bug-example/WEB-INF/ including web2.xml. But, here it realizes that the target fil target/mwar-bug-example/WEB-INF/web.xml has an identical file name and time stamp. Therefor it skips that file. This can be seen in the log if you run Maven with the -X option. Here are the output from the first run:
{noformat}
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\dlg01\Downloads\mwar-bug-example-master\src\main\webapp]
[DEBUG]  + web1.xml has been copied.
[DEBUG]  + web2.xml has been copied.
[DEBUG] Dump of the current build pathSet content -->
[DEBUG] web1.xml
[DEBUG] web2.xml
[DEBUG] -- end of dump --
[DEBUG]  + WEB-INF/web.xml has been copied.
[INFO] Webapp assembled in [316 msecs]{noformat}
And here is the output from the second run:
{noformat}
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\dlg01\Downloads\mwar-bug-example-master\src\main\webapp]
[DEBUG]  + web1.xml has been copied.
[DEBUG]  + web2.xml has been copied.
[DEBUG] Dump of the current build pathSet content -->
[DEBUG] web1.xml
[DEBUG] web2.xml
[DEBUG] -- end of dump --
[DEBUG]  * WEB-INF/web.xml is up to date.
[INFO] Webapp assembled in [266 msecs] {noformat}
 


was (Author: dennisl):
The reason for this seems to be that the time stamp of the two web.xml files are identical.

In the first run the war plugin copies files into target/mwar-bug-example/WEB-INF/ including web1.xml.

During the second run the war plugin copies files into target/mwar-bug-example/WEB-INF/ including web2.xml. But, here it realizes that the target fil target/mwar-bug-example/WEB-INF/web.xml has an identical file name and time stamp. Therefor it skips that file. This can be seen in the log if you run Maven with the -X option. Here are the output from the first run:
{noformat}
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\dlg01\Downloads\mwar-bug-example-master\src\main\webapp]
[DEBUG]  + web1.xml has been copied.
[DEBUG]  + web2.xml has been copied.
[DEBUG] Dump of the current build pathSet content -->
[DEBUG] web1.xml
[DEBUG] web2.xml
[DEBUG] -- end of dump --
[DEBUG]  * WEB-INF/web.xml is up to date.
[INFO] Webapp assembled in [266 msecs]{noformat}
And here is the output from the second run:
{noformat}
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\dlg01\Downloads\mwar-bug-example-master\src\main\webapp]
[DEBUG]  + web1.xml has been copied.
[DEBUG]  + web2.xml has been copied.
[DEBUG] Dump of the current build pathSet content -->
[DEBUG] web1.xml
[DEBUG] web2.xml
[DEBUG] -- end of dump --
[DEBUG]  * WEB-INF/web.xml is up to date.
[INFO] Webapp assembled in [266 msecs] {noformat}
 

> When it is necessary to build more than one WAR archive at the same time, it fails to set different web.xml
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: MWAR-440
>                 URL: https://issues.apache.org/jira/browse/MWAR-440
>             Project: Maven WAR Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.0, 3.2.0, 3.2.2
>            Reporter: Tuzhilkin Mikhail
>            Priority: Major
>
> In an assembly, I need to create 2 WAR archives with different web.xml files at a time.
> For this I use the following plugin setting:
> {code:xml}
> <plugin>
>     <artifactId>maven-war-plugin</artifactId>
>     <version>3.2.2</version>
>     <configuration>
>         <packagingExcludes>web?.xml</packagingExcludes>
>         <skip>true</skip>
>     </configuration>
>     <executions>
>         <execution>
>             <id>1</id>
>             <phase>package</phase>
>             <goals>
>                 <goal>war</goal>
>             </goals>
>             <configuration>
>                 <skip>false</skip>
>                 <webXml>src/main/webapp/web1.xml</webXml>
>                 <warName>web1</warName>
>             </configuration>
>         </execution>
>         <execution>
>             <id>2</id>
>             <phase>package</phase>
>             <goals>
>                 <goal>war</goal>
>             </goals>
>             <configuration>
>                 <skip>false</skip>
>                 <webXml>src/main/webapp/web2.xml</webXml>
>                 <warName>web2</warName>
>             </configuration>
>         </execution>
>     </executions>
> </plugin>
> {code}
> {code}
> Project structure:
> src/main/webapp/web1.xml
> src/main/webapp/web2.xml
> pom.xml
> {code}
> {code:xml}
> <!-- web1.xml -->
> <web-app>
>     <!--    Content web1.xml-->
> </web-app>
> {code}
> {code:xml}
> <!-- web2.xml -->
> <web-app>
>     <!--    Content web2.xml-->
> </web-app>
> {code}
> But the first of the specified files gets into both archives, despite the different paths <webXml>.
> {code}
> $ unzip -p web1.war WEB-INF/web.xml
> <web-app>
>     <!--    Content web1.xml-->
> </web-app>
> $ unzip -p web2.war WEB-INF/web.xml
> <web-app>
>     <!--    Content web1.xml-->
> </web-app>
> {code}
> Example project: [https://github.com/tuzhms/mwar-bug-example]



--
This message was sent by Atlassian Jira
(v8.20.7#820007)