File tree 1 file changed +10
-4
lines changed
src/main/java/org/apache/maven/plugins/gpg
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 21
21
22
22
import java .io .File ;
23
23
import java .io .IOException ;
24
+ import java .nio .file .Path ;
24
25
import java .util .ArrayList ;
25
26
import java .util .List ;
26
27
@@ -192,7 +193,7 @@ else if ( project.getAttachedArtifacts().isEmpty() )
192
193
193
194
File file = artifact .getFile ();
194
195
195
- if ( isExcluded ( file . getPath () ) )
196
+ if ( isExcluded ( artifact ) )
196
197
{
197
198
getLog ().debug ( "Skipping generation of signature for excluded " + file );
198
199
continue ;
@@ -223,19 +224,24 @@ else if ( project.getAttachedArtifacts().isEmpty() )
223
224
/**
224
225
* Tests whether or not a name matches against at least one exclude pattern.
225
226
*
226
- * @param name The name to match. Must not be <code>null</code>.
227
+ * @param artifact The artifact to match. Must not be <code>null</code>.
227
228
* @return <code>true</code> when the name matches against at least one exclude pattern, or <code>false</code>
228
229
* otherwise.
229
230
*/
230
- protected boolean isExcluded ( String name )
231
+ protected boolean isExcluded ( Artifact artifact )
231
232
{
233
+ final Path projectBasePath = project .getBasedir ().toPath ();
234
+ final Path artifactPath = artifact .getFile ().toPath ();
235
+ final String relativeArtifactPath = projectBasePath .relativize ( artifactPath ).toString ();
236
+
232
237
for ( String exclude : excludes )
233
238
{
234
- if ( SelectorUtils .matchPath ( exclude , name ) )
239
+ if ( SelectorUtils .matchPath ( exclude , relativeArtifactPath ) )
235
240
{
236
241
return true ;
237
242
}
238
243
}
244
+
239
245
return false ;
240
246
}
241
247
You can’t perform that action at this time.
0 commit comments