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 19
19
* under the License.
20
20
*/
21
21
22
+ import static org .junit .Assume .assumeTrue ;
23
+
22
24
import java .io .File ;
23
25
import java .io .IOException ;
24
26
import java .nio .file .Files ;
@@ -155,6 +157,27 @@ public void assertFileExists( ArtifactItem item, boolean exist )
155
157
assertEquals ( exist , file .exists () );
156
158
}
157
159
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
+
158
181
public void assertFilesAreLinks ( Collection <ArtifactItem > items , boolean areLinks )
159
182
{
160
183
for ( ArtifactItem item : items )
@@ -268,6 +291,8 @@ public void testCopyToLocation()
268
291
public void testLink ()
269
292
throws Exception
270
293
{
294
+ assumeTrue ("supports symbolic links" , supportsSymbolicLinks );
295
+
271
296
List <ArtifactItem > list = stubFactory .getArtifactItems ( stubFactory .getClassifiedArtifacts () );
272
297
273
298
mojo .setArtifactItems ( createArtifactItemArtifacts ( list ) );
You can’t perform that action at this time.
0 commit comments