File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/test/java/org/apache/maven/plugins/dependency/fromConfiguration Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1919 * under the License.
2020 */
2121
22+ import static org .junit .Assume .assumeTrue ;
23+
2224import java .io .File ;
2325import java .io .IOException ;
2426import java .nio .file .Files ;
@@ -155,6 +157,27 @@ public void assertFileExists( ArtifactItem item, boolean exist )
155157 assertEquals ( exist , file .exists () );
156158 }
157159
160+ private static final boolean supportsSymbolicLinks = supportsSymbolicLinks ();
161+
162+ private static boolean supportsSymbolicLinks ( )
163+ {
164+ try {
165+ Path target = Files .createTempFile ( null , null );
166+ Path link = Files .createTempFile ( null , null );
167+ Files .delete ( link );
168+ try {
169+ Files .createSymbolicLink ( link , target );
170+ } catch ( IOException e ) {
171+ return false ;
172+ }
173+ Files .delete ( link );
174+ Files .delete ( target );
175+ return true ;
176+ } catch ( IOException e ) {
177+ throw new RuntimeException ( e );
178+ }
179+ }
180+
158181 public void assertFilesAreLinks ( Collection <ArtifactItem > items , boolean areLinks )
159182 {
160183 for ( ArtifactItem item : items )
@@ -268,6 +291,8 @@ public void testCopyToLocation()
268291 public void testLink ()
269292 throws Exception
270293 {
294+ assumeTrue ("supports symbolic links" , supportsSymbolicLinks );
295+
271296 List <ArtifactItem > list = stubFactory .getArtifactItems ( stubFactory .getClassifiedArtifacts () );
272297
273298 mojo .setArtifactItems ( createArtifactItemArtifacts ( list ) );
You can’t perform that action at this time.
0 commit comments