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

Jörg Delker commented on MDEP-629:
----------------------------------

I've debugged this and figured the following:

When the UnpackMojo is evaluating the artifacts in getProcessedArtifactItems, 
it calls super.getProcessedArtifactItems. Within further calls, that method 
checks for an existing marker file in DefaultFileMarkerHandler.isMarkerSet(), 
with a file name that is build though getMarkerFile().

That method is provided through UnpackFileMarkerHandler:getMarkerFile(), which 
constructs a file name from various settings. Part of that are the "includes" 
and "excludes" that were used in the artifact definition (see pom above). If 
any of those are set, a unique hash is computed and appended to the marker file 
name.

However, debugging shows, that the exclude as defined in the pom has not been 
applied to the artifact yet and is therefor not included in the computation of 
the marker file. In fact, the marker file is computes as 

{{target/dependency-maven-plugin-markers/myartifactfile-1.0.marker}}

when the check for existence is performed.

 

After the unpack operation has been performed, a new marker file is created to 
state the successful operation. This time, the artifact is complete - including 
the exclude definition. So the computed marker file is

{{target/dependency-maven-plugin-markers/myartifactfile-1.01480985089}}

 

Quod erat demonstrandum.

Due to the different file name computations, the UnpackMojo is not capable of 
detecting the already extracted dependency.

> Unpack goal with includes/excludes doer not honor marker files
> --------------------------------------------------------------
>
>                 Key: MDEP-629
>                 URL: https://issues.apache.org/jira/browse/MDEP-629
>             Project: Maven Dependency Plugin
>          Issue Type: Bug
>          Components: unpack, unpack-dependencies
>    Affects Versions: 3.1.1
>            Reporter: Jörg Delker
>            Priority: Major
>
> When using the unpack goal to extract an artifact dependency, that action is 
> performed regardless of any previous run which already created a marker file.
> Consider this pom extract:
> {noformat}
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-dependency-plugin</artifactId>
>   <version>3.1.1</version>
>   <executions>
>     <execution>
>       <id>unpack</id>
>       <phase>generate-sources</phase>
>       <goals>
>         <goal>unpack</goal>
>       </goals>
>       <configuration>
>         <excludes>${my.excludes}</excludes>
>         <artifactItems>
>           <artifactItem>
>             <groupId>groupid</groupId>
>             <artifactId>artifactid</artifactId>
>             <type>war</type>            
>             <overWrite>false</overWrite>
>           </artifactItem>
>         </artifactItems>
>       </configuration>
>     </execution>
>   </executions>
> </plugin>{noformat}
> After executing "mvn generate-sources", the following marker file has been 
> created:
> {{target/dependency-maven-plugin-markers/myartifactfile-1.01480985089}}
> Obviously, this file is not checked when this run is repeated.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to