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

Herve Boutemy commented on MWAR-443:
------------------------------------

did you check what timestamp is set with dependency:copy-dependencies: is it 
"now" or the timestamp of the jar from ~/.m2/repo

given the file is deleted, I imagine it's not "now"

> Maven WAR plugin is deleting files generated by Maven Dependency plugin after 
> upgrading to 3.3.1
> ------------------------------------------------------------------------------------------------
>
>                 Key: MWAR-443
>                 URL: https://issues.apache.org/jira/browse/MWAR-443
>             Project: Maven WAR Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.1
>            Reporter: David Benes
>            Priority: Major
>
> In my project, I'm using Derby database. Derby also needs locales, otherwise 
> I get warning in the log file. Derby mentings these locales in manifest file 
> without versions. So I ended up using something like following pom.xml 
> (simplified)
> {code:java}
> <project xmlns="http://maven.apache.org/POM/4.0.0";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>test</groupId>
>     <artifactId>maven-war-issue</artifactId>
>     <version>0.0.1</version>
>     <packaging>war</packaging>
>     <properties>
>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>         <derby.version>10.14.2.0</derby.version>
>     </properties>
>     <dependencies>
>         <dependency>
>             <groupId>org.apache.derby</groupId>
>             <artifactId>derby</artifactId>
>             <version>${derby.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.derby</groupId>
>             <artifactId>derbyLocale_cs</artifactId>
>             <version>${derby.version}</version>
>             <scope>provided</scope>
>         </dependency>
>     </dependencies>
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>3.8.1</version>
>                 <configuration>
>                     <source>1.8</source>
>                     <target>1.8</target>
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-dependency-plugin</artifactId>
>                 <version>3.2.0</version>
>                 <executions>
>                     <execution>
>                         <id>copy</id>
>                         <phase>prepare-package</phase>
>                         <goals>
>                             <goal>copy-dependencies</goal>
>                         </goals>
>                         <configuration>
>                             
> <includeArtifactIds>derbyLocale_cs</includeArtifactIds>
>                             
> <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib</outputDirectory>
>                             <overWriteReleases>false</overWriteReleases>
>                             <overWriteSnapshots>false</overWriteSnapshots>
>                             <overWriteIfNewer>true</overWriteIfNewer>
>                             <stripVersion>true</stripVersion>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-war-plugin</artifactId>
>                 <version>3.3.1</version>
>                 <configuration>
>                     <warSourceDirectory>WebContent</warSourceDirectory>
>                     <failOnMissingWebXml>false</failOnMissingWebXml>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
> </project>{code}
> After upgrading to Maven WAR plugin, this stopped working because after 
> copying artifacts, by the Maven Dependency plugin to correct location they 
> are deleted by Maven WAR plugin as shown in below:
> {code:java}
> C:\code\maven-war-issue>mvn package
> [INFO] Scanning for projects...
> [INFO]
> [INFO] ------------------------< test:maven-war-issue 
> >------------------------
> [INFO] Building maven-war-issue 0.0.1
> [INFO] --------------------------------[ war 
> ]---------------------------------
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ 
> maven-war-issue ---
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] skip non existing resourceDirectory 
> C:\code\maven-war-issue\src\main\resources
> [INFO]
> [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ 
> maven-war-issue ---
> [INFO] No sources to compile
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ 
> maven-war-issue ---
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] skip non existing resourceDirectory 
> C:\code\maven-war-issue\src\test\resources
> [INFO]
> [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ 
> maven-war-issue ---
> [INFO] No sources to compile
> [INFO]
> [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven-war-issue 
> ---
> [INFO] No tests to run.
> [INFO]
> [INFO] --- maven-dependency-plugin:3.2.0:copy-dependencies (copy) @ 
> maven-war-issue ---
> [INFO] Copying derbyLocale_cs-10.14.2.0.jar to 
> C:\code\maven-war-issue\target\maven-war-issue-0.0.1\WEB-INF\lib\derbyLocale_cs.jar
> [INFO]
> [INFO] --- maven-war-plugin:3.3.1:war (default-war) @ maven-war-issue ---
> [INFO] Packaging webapp
> [INFO] Assembling webapp [maven-war-issue] in 
> [C:\code\maven-war-issue\target\maven-war-issue-0.0.1]
> [INFO] Processing war project
> [INFO] deleting outdated resource WEB-INF\lib\derbyLocale_cs.jar
> [INFO] Building war: C:\code\maven-war-issue\target\maven-war-issue-0.0.1.war
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  1.944 s
> [INFO] Finished at: 2021-07-09T16:35:29+02:00
> [INFO] 
> ------------------------------------------------------------------------C:\code\maven-war-issue>
> {code}
> For me it seems to be the same as MWAR-433, but as that was already fixed in 
> version 3.3.1, this seems to be another case.
> Is there some way how I can mark those artifacts copied by Maven Dependency 
> plugin as not outdated?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to