File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/main/java/org/apache/maven/plugins/gpg Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 2121
2222import java .io .File ;
2323import java .io .IOException ;
24+ import java .nio .file .Path ;
2425import java .util .ArrayList ;
2526import java .util .List ;
2627
@@ -192,7 +193,7 @@ else if ( project.getAttachedArtifacts().isEmpty() )
192193
193194 File file = artifact .getFile ();
194195
195- if ( isExcluded ( file . getPath () ) )
196+ if ( isExcluded ( artifact ) )
196197 {
197198 getLog ().debug ( "Skipping generation of signature for excluded " + file );
198199 continue ;
@@ -223,19 +224,24 @@ else if ( project.getAttachedArtifacts().isEmpty() )
223224 /**
224225 * Tests whether or not a name matches against at least one exclude pattern.
225226 *
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>.
227228 * @return <code>true</code> when the name matches against at least one exclude pattern, or <code>false</code>
228229 * otherwise.
229230 */
230- protected boolean isExcluded ( String name )
231+ protected boolean isExcluded ( Artifact artifact )
231232 {
233+ final Path projectBasePath = project .getBasedir ().toPath ();
234+ final Path artifactPath = artifact .getFile ().toPath ();
235+ final String relativeArtifactPath = projectBasePath .relativize ( artifactPath ).toString ();
236+
232237 for ( String exclude : excludes )
233238 {
234- if ( SelectorUtils .matchPath ( exclude , name ) )
239+ if ( SelectorUtils .matchPath ( exclude , relativeArtifactPath ) )
235240 {
236241 return true ;
237242 }
238243 }
244+
239245 return false ;
240246 }
241247
You can’t perform that action at this time.
0 commit comments