jira-importer commented on issue #395: URL: https://github.com/apache/maven-ear-plugin/issues/395#issuecomment-2955288292
**[Fabian Schlier](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=fschlier)** commented Hi, we encountered the same issue and isolated the faulty code causing the problem. WIthin EarMojo the artifacts to be deleted are located via a check that calls ``` File artifact = new File(new File(workDirectory, module.getLibDir()), jm.getOriginalBundleFileName()); ``` and is the file is found, it is deleted. To solve issues with timestamped/non-timestamped artifacts the file location check process should be done twice, to allow the configured `fileNameMapping`/`useBaseVersions` to be encountered. Code should look like this: ``` File artifact = new File(new File(workDirectory, module.getLibDir()), jm.getOriginalBundleFileName()); if (!artifact.exists()) { // Check if we find the file when using configured naming policy artifact = new File(new File(workDirectory, module.getLibDir()), jm.getBundleFileName()); } if (artifact.exists()) { getLog().debug(" -> Artifact to delete: " + artifact); if (!(artifact.delete())) { getLog().error("Could not delete '" + artifact + "'"); } } ``` This would add some more flexibility for more complex scenarios. Cheers, Fabian -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
