History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-16746
Type: Bug Bug
Status: Open Open
Assignee: Anton Makeev
Reporter: Esko Luontola
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

IDEA handles resource folders differently from Maven (resources should be copied to output directory and not compiled)

Created: 20 Dec 07 19:37   Updated: 11 Jan 08 15:14
Component/s: Compiling Project, Maven Integration

File Attachments: 1. Zip Archive resource-test.zip (12 kb)

Image Attachments:

1. compiler-settings.jpg
(45 kb)
Environment: Maven 2.0.8, WinXP

Build: 7,590
Severity: Medium


 Description  « Hide
I've attached resource-test.zip which contains a project whose tests fail when the project is compiled by IDEA, but which pass when the tests are run in Maven. Workaround: When Maven has first been run and the output directory is not cleaned, then the tests pass also in IDEA.

Also, when resource-test.ipr is opened in IDEA, it complains about syntax errors in \src\test\resources\MyResource2.java even though it is technically a resource file and thus IDEA should not try to compile it. Maven does not complain about it, because it does not compile files in resource folders.

The expected behaviour (as Maven does it) is that all files in the resource directories are copied to the output directory as-is. If there are .java files in a resource directory, they should NOT be compiled (and IDEA should not complain about syntax errors in them). If the java and resource directories are the same (such as is configured for example in http://www.jdave.org/pom.xml) then the .java files should be compiled to .class files AND the .java files should also be copied to the output folder.

This appears to be related to IDEA-14587



 All   Comments   Work Log   Change History      Sort Order:
Christian Nelson - 20 Dec 07 20:00
To get around this, I manually set the compiler resource pattern to "!?*.java" (see compiler-settings.jpg) which copies everything but java source files.

It would be great if this was the default for IDEA across the board. If not across the board, then at least set it for maven projects.


Esko Luontola - 22 Dec 07 01:50
Using "!?*.java" does not solve the problem that you can't have .java files as resources. There is a need for true resource directory support.

In my code formatting plugin I would have liked to have .java files in the /src/test/resources directory as test data for my unit tests, but to avoid conflicts with IDEA's compiler I had to rename them to .java.txt so that they would not be compiled accidentally.


Christian Nelson - 22 Dec 07 02:22
Esko: you're completely right... I didn't read your description well enough the first time through.

While I do think the default compiler resource path should be "Unable to render embedded object: File (?*.java", I have a hard time thinking of why you'd ever have any java files which shouldn't be compiled (are you working on a Java parser?). I see the discrepancy between maven and idea that you're describing, though it seems like a corner case scenario. Good luck) not found.


Anton Makeev - 24 Dec 07 11:58
It's pretty possible that we will introduce notion of resource folder in the next idea major version.

Bas Leijdekkers - 03 Jan 08 17:50
Is there a JIRA issue open somewhere for the "notion of resource folder"? I would like to vote for it.

Anton Makeev - 11 Jan 08 15:14
I'm afraid there isn't. The feature is still quite vague.