mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Maven: resourc ecompiler handles big files
This commit is contained in:
+9
-1
@@ -377,7 +377,15 @@ public class MavenResourceCompiler implements ClassPostProcessingCompiler {
|
||||
try {
|
||||
outputFile.getParentFile().mkdirs();
|
||||
|
||||
if (eachItem.isFiltered()) {
|
||||
boolean shouldFilter = eachItem.isFiltered();
|
||||
if (sourceFile.length() > 10 * 1024 * 1024) {
|
||||
context.addMessage(CompilerMessageCategory.WARNING,
|
||||
"Maven: File is too big to be filtered. Most likely it is a binary file and should be excluded from filtering.",
|
||||
sourceVirtualFile.getUrl(), -1, -1);
|
||||
shouldFilter = false;
|
||||
}
|
||||
|
||||
if (shouldFilter) {
|
||||
String charset = sourceVirtualFile.getCharset().name();
|
||||
String text = new String(FileUtil.loadFileBytes(sourceFile), charset);
|
||||
String escapedCharacters = "properties".equals(sourceVirtualFile.getExtension()) ? "\\" : null;
|
||||
|
||||
+21
-1
@@ -3,8 +3,8 @@ package org.jetbrains.idea.maven.compiler;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.idea.maven.MavenImportingTestCase;
|
||||
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter;
|
||||
import org.jetbrains.idea.maven.importing.MavenDefaultModifiableModelsProvider;
|
||||
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -675,6 +675,26 @@ public class ResourceFilteringTest extends MavenImportingTestCase {
|
||||
"value2=\\value\n");
|
||||
}
|
||||
|
||||
public void testDoNotFilterButCopyBigFiles() throws Exception {
|
||||
createProjectSubFile("resources/file.xyz").setBinaryContent(new byte[1024 * 1024 * 20]);
|
||||
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<build>" +
|
||||
" <resources>" +
|
||||
" <resource>" +
|
||||
" <directory>resources</directory>" +
|
||||
" <filtering>true</filtering>" +
|
||||
" </resource>" +
|
||||
" </resources>" +
|
||||
"</build>");
|
||||
compileModules("project");
|
||||
|
||||
assertNotNull(myProjectPom.getParent().findFileByRelativePath("target/classes/file.xyz"));
|
||||
}
|
||||
|
||||
private void assertResult(String relativePath, String content) throws IOException {
|
||||
assertResult(myProjectPom, relativePath, content);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user