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

Fabian Schlier commented on MEAR-217:
-------------------------------------

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

{code:title=EarMojo.java changeManifestClasspath() Line 827 |borderStyle=solid}
File artifact = new File(new File(workDirectory, module.getLibDir()), 
jm.getOriginalBundleFileName());
{code}
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:

{code:title=EarMojo.java changeManifestClasspath()|borderStyle=solid}
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 + "'");
  }
}
{code}

This would add some more flexibility for more complex scenarios.

Cheers,
Fabian

> Snapshot dependencies are not deleted from skinny WARs
> ------------------------------------------------------
>
>                 Key: MEAR-217
>                 URL: https://issues.apache.org/jira/browse/MEAR-217
>             Project: Maven Ear Plugin
>          Issue Type: Bug
>            Reporter: Tamás Baráth
>             Fix For: more-investigation
>
>         Attachments: test-project.zip
>
>
> EAR plugin doesn't delete snapshot dependencies from skinny WARs if Maven has 
> downloaded that dependencies from a remote repository. The EAR contains the 
> files in library bundle directory and in WEB-INF/lib folder of the WARs as 
> well.
> When snapshots are installed to local repository with 'mvn install' command, 
> the plugin works fine.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to