diff --git a/jps/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy b/jps/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy
index 2deb44cafbe9..423f35e4197a 100644
--- a/jps/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy
+++ b/jps/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy
@@ -142,6 +142,9 @@ public class IdeaProjectLoader {
if (pattern.indexOf('/') == -1) {
return "**/" + pattern
}
+ if (pattern.startsWith("/")) {
+ return pattern.substring(1)
+ }
return pattern
}
diff --git a/jps/testData/resourceCopying/resourceCopying.iml b/jps/testData/resourceCopying/resourceCopying.iml
new file mode 100644
index 000000000000..d5c074327501
--- /dev/null
+++ b/jps/testData/resourceCopying/resourceCopying.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jps/testData/resourceCopying/resourceCopying.ipr b/jps/testData/resourceCopying/resourceCopying.ipr
new file mode 100644
index 000000000000..e318ebf89282
--- /dev/null
+++ b/jps/testData/resourceCopying/resourceCopying.ipr
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jps/testData/resourceCopying/src/a.txt b/jps/testData/resourceCopying/src/a.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/jps/testData/resourceCopying/src/ab.txt b/jps/testData/resourceCopying/src/ab.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/jps/testData/resourceCopying/src/copy/file.txt b/jps/testData/resourceCopying/src/copy/file.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/jps/testData/resourceCopying/src/copy/subdir/file2.txt b/jps/testData/resourceCopying/src/copy/subdir/file2.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/jps/testData/resourceCopying/src/copyTree/subdir/abc.txt b/jps/testData/resourceCopying/src/copyTree/subdir/abc.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/jps/testData/resourceCopying/src/copyTree/subdir/xxx.xml b/jps/testData/resourceCopying/src/copyTree/subdir/xxx.xml
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/jps/testData/resourceCopying/src/copyTree/xyz.txt b/jps/testData/resourceCopying/src/copyTree/xyz.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/jps/testData/resourceCopying/src/index.html b/jps/testData/resourceCopying/src/index.html
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/jps/testSrc/org/jetbrains/jps/ResourceCopyingTest.groovy b/jps/testSrc/org/jetbrains/jps/ResourceCopyingTest.groovy
new file mode 100644
index 000000000000..b8535d2fd9ba
--- /dev/null
+++ b/jps/testSrc/org/jetbrains/jps/ResourceCopyingTest.groovy
@@ -0,0 +1,26 @@
+package org.jetbrains.jps
+
+/**
+ * @author nik
+ */
+class ResourceCopyingTest extends JpsBuildTestCase {
+ public void testOverwriteArtifacts() throws Exception {
+ doTest("testData/resourceCopying/resourceCopying.ipr", {}, {
+ dir("production") {
+ dir("resourceCopying") {
+ dir("copy") {
+ file("file.txt")
+ }
+ dir("copyTree") {
+ dir("subdir") {
+ file("abc.txt")
+ }
+ file("xyz.txt")
+ }
+ file("a.txt")
+ file("index.html")
+ }
+ }
+ })
+ }
+}