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

Key: IDEA-14587
Type: Bug Bug
Status: Waiting for Reply Waiting for Reply
Assignee: Eugene Zhuravlev
Reporter: Jesper Thuun-Petersen
Votes: 2
Watchers: 3
Operations

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

Missing properties when running

Created: 28 Aug 07 16:32   Updated: 22 Dec 07 01:31
Component/s: Compiling Project, Packaging and Installation

File Attachments: 1. Zip Archive test.zip (17 kb)

Image Attachments:

1. compiler settings.jpg
(65 kb)

2. project settings.jpg
(114 kb)

3. Project settings.jpg
(440 kb)

4. run.jpg
(100 kb)

5. screenshot-1.jpg
(39 kb)
Environment: XP

Build: 7,241
Severity: Low


 Description  « Hide
I have a project with this structure:
  • src
    • java
    • language
    • test

Both java and language folders are marked as src-folders in the module settings.

The language folder contains a resource bundle (properties-file).

When I run a test case, the system reports a missing resource bundle. If I copy the file manually to where IntelliJs compiler has put the class files, the test runs without problems.

It seems as though resource files as defined in compiler settings is not copied during compilation?



 All   Comments   Work Log   Change History      Sort Order:
Eugene Zhuravlev - 31 Aug 07 16:43
please check that the run configuration for your testcase has compilation enabled "before launch".

Jesper Thuun-Petersen - 31 Aug 07 16:50
Yes, the "before launch steps" option is enabled.

Eugene Zhuravlev - 31 Aug 07 16:58
What about "Make" option in "Before Launch" group (see te bottom of the configuration pane)?

Eugene Zhuravlev - 31 Aug 07 16:59
Also, what module is specified in "Use classpath and JDK of module" field?

Jesper Thuun-Petersen - 31 Aug 07 17:03
The make option is also checked, and the module is the module in which the test is located.

Eugene Zhuravlev - 05 Sep 07 16:48
Unfortunately I was not able to reproduce.
I've created the following test case:

public class ATest extends TestCase {
public void testSimple() throws IOException { Properties props = new Properties(); props.load(new FileInputStream(new File("propfile.properties"))); System.out.println("Properties read: "); props.list(System.out); }
}

and the following properties file:
aaa=aaaValue
bbb=bbbValue

Put them into the directory structure as described in the issue description. Created a run configuration, made sure the checkbox "Make before run" was checked and set up a working direcory for a test to point to compiler output directory. The test runs ok, propfile.properties is copied to compiler output witout any problems.

Could you please create a test project that illustrates the bug?


Sascha Weinreuter - 05 Sep 07 16:57
Maybe the compiler resource patterns setting (see the screenshot) got screwed up somehow? Just a guess...

Sébastien Lebel - 07 Sep 07 02:17
I have a similar problem. My resources (located in a resources folder) are not copied to the output folder.

My project follows default Maven 1.1 directory structure (target contains the compiled classes).

I tried the same resource pattern you can see in the screenshot and I tried the one from the help screen ( .+\.(properties|gif|png|jpeg|xml) ).

Attached you will find a zip of a test project folder having the same problem. Here are the steps required to create an identical project :

> mkdir test
> cd test
> maven genapp (maven 1.1)
> maven idea

Using build 7255 of IDEA


Eugene Zhuravlev - 07 Sep 07 16:57
Sébastien,
there are two problems about the project:
1. the "resources" directory must be marked as a source root
2. The pattern ".+\.(properties|gif|png|jpeg|xml) " won't match because it is a regular expression, but the field expects semicolon-separated list of patterns using file system wildcards (? or *), not regular expression. The regular expressions were used in previous versions, but were replaced with wildcards because of lots of complains from users that it was had to write a regular expression.

After fixing the above issues everything works fine for me.


Sébastien Lebel - 07 Sep 07 17:40
Eugene,

Did 1 and 2 and everything now works fine for me too.

Thank you very much,

Sébastien


Jesper Thuun-Petersen - 12 Sep 07 11:44
I have attached my project settings, my compiler settings and my run configuration. Everything is as it is supposed to be, I think, but I still have the problem.
If you can't spot the error in the screenshots, I will try to create at test project.

Esko Luontola - 20 Dec 07 19:44
There is a related issue IDEA-16746 which shows how IDEA handles resources differently from Maven. A minimal project with unit tests showing the problem is provided.

Penny Rohr - 22 Dec 07 01:31
I've noticed that adding a directory as a library does not include it in the runtime classpath and is causing problems for resource loading as a general rule. This worked in IDEA 5.x.

I never include resources with my compiled code; these are always maintained separately and I don't want them included in source trees.